I am trying to query my SQL database via sqldatasource in my VB.NET code for my webform and would like the results to be stored in a Crystal Report parameter field so that I can then pass it to my report
I am trying to get an asp:SessionParameter of a SelectParameters, to use a property of an object in session instead of having a string in the session like Session["CustomerID"]
Something like Session["Customer"] where the property is ((Customer) Session["Customer"]).CustomerID)
My code:
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:DBConnectionString %>" xmlns:asp="#unknown"> SelectCommand="SELECT * FROM getStoreCustomers (@customerID,@week,@day)" ProviderName="System.Data.SqlClient"> <selectparameters> <asp:sessionparameter name="customerID" sessionfield="Customer" /> ?????? (what is the syntax to pass the property here?) <asp:controlparameter controlid="ddWeek" defaultvalue="-1" name="week" propertyname="SelectedValue" /> <asp:controlparameter controlid="ddDay" defaultvalue="-1" name="day" propertyname="SelectedValue" /> </selectparameters>
The class I use is like any other class (but serializable)
[Serializable] public class Customer { public int CustomerID { get; set; } }
But I get the error message that I can't create an object of the type System.TypeCode from the string containing SB.BusinessLogic.DomainEntity.User for the property Type.
we have a situation where we log visits and visitors on page hits and bots are clogging up our database. We can't use captcha or other techniques like that because this is before we even ask for human input, basically we are logging page hits and we would like to only log page hits by humans.
Is there a list of known bot IP out there? Does checking known bot user-agents work?
Just wondering if it is possible to programatically highlight all the text within a textbox.
Specifically, I have a text box with validation. If an error is thrown, I set the focus to the specified textbox, but the way it works now the user starts typing and none of the text that already exists disappears. I'm wondering if I can make it so that if the error is thrown, not only is the focus set to the textbox, but the text within the textbox is selected, so that if they simply start typing all of the old text disappears, or they can click and retype a single character if necessary.
The ChecBox will be selected according to the user needs: 1, 2, 3 or more... When the page is fired, I wanted to get in the code behind the box which are checked so I can build a query consequently. So in the code behin, i have this:
I'm looking for a way to export a Word document as a PDF. I would like to do this without the use of a "software printer" (such as CutePDF, etc.) and stick to reference assemblies if at all possible. I'm using Microsoft Office Interop Assemblies to generate a Word Document which I save to a temporary directory. So its not necessary for this solution to interact directly with Microsoft Office, unless it needs to.
way to open a new tab on the current window? I'm thinking to have a control button on the webform and have this control button to open a web page on the new tab.
There is a website which shows history of lottery numbers. I want to retrieve numbers from the page, by using C# Windows or Web program(ASP.NET).There is a problem that, after selecting the week which you want numbers for from dropdownlist, page does not post. Numbers are retrieved by Ajax.
How can I get numbers for all of the weeks by program?
I like to build a components collection project so that I can use those components later on other projects. For example I created a UserControl called MyDataGrid.ascx
So suppose the projects layout are something like this:
--> IPGostarProject - Under namespace of IPGostar - contains components and lot's of user controls --> SampleProject - here I want to use MyDataGrid.ascx UserControl from IPGostar namespace.
But as you know LoadControl function only takes virtual directory as it's parameter. So you can't load anything outside the SampleProject directory!
I am using GetMethods() method to get the list of all the available methods in WCF. But it returns everything, how can I only show the methods that I exposed to client.
[Code]....
How can I filter the methods only to WCF Servicecontracts?
am using c# with asp.net for wspproject. I am using spgridview to show the folders and files. When i clicked on folder, the spgridview bind with folder content(files/folders).Now i need to navigate folders based on the folder names like navigation bar in sharepoint.How to create the navigation bar for sharepoint folders?
I am dynamically generating a number of different types of files based upon a GridView in ASP.NET - an Excel spreadsheet and a HTML file. I am doing so using this code (this is just for the Excel spreadsheet):
I would like to give users the options of emailing the generated file as an attachment to either an email address they specify or one linked with their account on the database. But I don't want the user to have to save the file, then attach it in a form - I'd like to automatically attach the generated file. Is this possible, and how easy is it?
Of course, I'll be using the System.Net.Mail class to send mail...if it's possible anyway!
How do I get the value of the errorMode property set in the <system.webServer><httpErrors> element in web.config?
I'm trying to implement some "self-diagnostics" in an ASP.NET web application. When the app starts, it runs through some of the settings in web.config and confirm they're set correctly. While this code works quite nicely when the errormode is set in the <system.web><customErrors> element,
var errSec = (CustomErrorsSection)HttpContext.Current.GetSection("system.web/customErrors"); Response.Write(errSec.Mode.ToString());
it won't work once the site is deployed on IIS7 and this setting is now found in system.webServer -> httpErrors.
This won't work:
var errSec = (CustomErrorsSection)HttpContext.Current.GetSection("system.webServer/httpErrors"); And casting to a CustomErrorsSection also seems like a bad idea, there must be a better type to use?
I found this article on IIS.NET, HTTP Errors , but I hope to do this without the dependency on the Microsoft.Web.Administration library.
Okay, based on the suggestion below, I tried this:
var errSec = (ConfigurationSection)HttpContext.Current.GetSection("system.webServer/httpErrors"); Response.Write(errSec.SectionInformation.GetRawXml().ToString());
But that doesn't work either, the errSec object is null. And on a side-note, if I load the <system.web><customErrors> section using the same approach, the GetRawXml() method call fails with a "This operation does not apply at runtime." exception message.
I know how to load the whole web.config as an xml file and query that to get to the element I need. But it just seems to me like there must be a more elegant approach. How to read web.config as xml:
var conf = XDocument.Load(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "web.config"); var errMode = conf.Root.Element("system.webServer").Element("httpErrors").Attribute("errorMode").Value;
but that's just nasty! And if the errorMode setting is set in machine.config or similar, it won't work.
I have stored image path in database. While displaying I have to get the image path from database and set it as the ImageUrl of Asp.NET Image control.But it is not displaying the image. below is the code of that.protected void Button1_Click(object sender, EventArgs e)