QueryStringParameter.QueryStringParameter(String, TypeCode, String) Constructor

Initializes a new named and strongly typed instance of the QueryStringParameter class, using the specified string to identify which query string field to bind to.

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

public:
QueryStringParameter (
	String^ name, 
	TypeCode type, 
	String^ queryStringField
)
public QueryStringParameter (
	String name, 
	TypeCode type, 
	String queryStringField
)
public function QueryStringParameter (
	name : String, 
	type : TypeCode, 
	queryStringField : String
)
Not applicable.

Parameters

name

The name of the parameter.

type

The type that the parameter represents. The default is Object.

queryStringField

The name of the query string field that the parameter object is bound to. The default is Empty.

A QueryStringParameter object created with the QueryStringParameter constructor is initialized with the specified parameter name, Type, and string that identifies the query string field that the parameter binds to. Only the Direction and ConvertEmptyStringToNull properties are initialized with default values.

The following code example demonstrates how to create a QueryStringParameter object with the QueryStringParameter constructor and add it to an AccessDataSource control's FilterParameters collection. A GridView control displays data only if the "employee" and "country" query string fields are passed on the query string with valid values.

No code example is currently available or this language may not be supported.
<%@ Page language="VJ#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
private void Page_Load(Object sender, System.EventArgs e)
{
    QueryStringParameter countryFilter = new QueryStringParameter("country",
        System.TypeCode.String, "country");

    MyAccessDataSource.get_FilterParameters().Add(countryFilter);
} //Page_Load
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">

      <!-- Use a Query String with country=USA -->
      <asp:GridView
        id ="GridView1"
        runat="server"
        DataSourceID="MyAccessDataSource" />

      <asp:AccessDataSource
        id="MyAccessDataSource"
        runat="server"
        DataFile="Northwind.mdb"
        SelectCommand="SELECT EmployeeID, LastName, Address, PostalCode, Country FROM Employees"
        FilterExpression="Country = '@country'">
      </asp:AccessDataSource>
    </form>
  </body>
</html>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: