Gets or sets the name of the parameter.
Assembly: System.Web (in System.Web.dll)
Parameter objects are not required to have a name; however, data source controls might use the parameter name to match a Parameter object in a collection with a parameter in a SQL query or business method signature. For example, the SqlDataSource control can use the name of the Parameter object to match a placeholder in a parameterized SQL query. Similarly, the SqlDataSource control can use the name of a Parameter object in the FilterParameters collection to match a placeholder in the FilterExpression property. In some cases, the name is not used and the order in which the Parameter object is added to a ParameterCollection collection is more important. For more information, see Using Parameters with the SqlDataSource Control and Using Parameters with the ObjectDataSource Control.
If the name of the parameter is changed, the OnParameterChanged method is called.
The following code example demonstrates how to display filtered data using an ObjectDataSource control to retrieve data from a middle-tier business object and a GridView control to display the results. The code example consists of a TextBox control, a GridView control, the ObjectDataSource control, and a Submit button. By default, the TextBox control is populated with the name of one of the Northwind employees. The GridView control displays information about the employee identified by the name in the TextBox control. To retrieve data on another employee, enter the full name of the employee in the TextBox control and click the button.
The FilterExpression property specifies an expression used to filter the data retrieved by the SelectMethod property. It uses parameter placeholders that are evaluated to the parameters contained in the FilterParameters collection. In this example, the parameter placeholder is bounded by single quotation marks because the type of the parameter is a string type that might contain spaces. If the type of the parameter is a numeric or date type, bounding quotation marks are not needed.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.