QueryStringParameter Constructor ()
Assembly: System.Web (in system.web.dll)
A QueryStringParameter object created with the QueryStringParameter constructor is initialized with default values for all its properties. The QueryStringField is initialized to String.Empty. Additionally, the Name property is initialized to String.Empty, the Type property is initialized to TypeCode.Object, the Direction property is initialized to Input, and the DefaultValue property is initialized to null (Nothing in Visual Basic).
The following code example demonstrates how to use the QueryStringParameter constructor to create a new QueryStringParameter parameter and add it to the SelectParameters collection of an AccessDataSource control.
QueryStringParameter empIdParam = new QueryStringParameter();
empIdParam.set_Name("empId");
empIdParam.set_QueryStringField("empId");
AccessDataSource1.get_SelectParameters().Add(empIdParam);
The QueryStringParameter is added to the following AccessDataSource control and declared on a Web Form. The ListBox control uses the AccessDataSource control to bind and display data, whenever the Web Form is loaded with a query string that contains a field named "empId" and a corresponding value.
<asp:ListBox id ="ListBox2" runat="server" DataSourceID="AccessDataSource1" DataValueField="EmployeeID" DataTextField="LastName" /> <asp:AccessDataSource id="AccessDataSource1" runat="server" DataFile="Northwind.mdb" SelectCommand="Select EmployeeID, LastName From Employees where EmployeeID = ?" /> </asp:AccessDataSource>
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.