QueryStringParameter.QueryStringField Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the name of the query string field that the parameter binds to.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
property String^ QueryStringField {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_QueryStringField ()

/** @property */
public void set_QueryStringField (String value)

public function get QueryStringField () : String

public function set QueryStringField (value : String)

Property Value

A string that identifies the query string field that the parameter binds to.

The QueryStringField identifies a name/value pair that is passed on the query string. While the QueryStringField property identifies the name of the pair, the QueryStringParameter binds to its corresponding value at run time. If the expected query string name/value pair is not passed to the Web Form on the query string, the Evaluate method binds the parameter to the value of the DefaultValue property, if it is set. If the DefaultValue is not set, the Evaluate method fails to bind the parameter to a value.

The following code example demonstrates how to declaratively use a QueryStringParameter with a SqlDataSource control to display data in a ListBox control. The QueryStringField property is set to the name of the expected query string field and the parameter is added to the SelectParameters collection. A DefaultValue is provided in case the expected name/value pair is not passed on the query string.

No code example is currently available or this language may not be supported.
<asp:ListBox
  id ="ListBox1"
  runat="server"
  DataValueField="EmployeeID"
  DataTextField="LastName" />

<asp:SqlDataSource
  id="SqlDataSource1"
  runat="server"
  ConnectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;"
  SelectCommand="Select EmployeeID, LastName From Employees where EmployeeID = @empId">
  <SelectParameters>
    <asp:QueryStringParameter runat="server" Name="empId" QueryStringField="empId" />
  </SelectParameters>
</asp:SqlDataSource>

The following code example demonstrates how to declaratively use a QueryStringParameter with a SqlDataSource control to display data in a GridView control. The QueryStringParameter is added to the SelectParameters collection, along with other parameter objects that are used as an output parameter and return value parameter. Handle values returned from the stored procedure used to retrieve data. This code example is part of a larger example provided for the SqlDataSourceStatusEventArgs class.

No code example is currently available or this language may not be supported.

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.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: