Gets a collection of parameters that are associated with any parameter placeholders that are in the FilterExpression string.
Assembly: System.Web (in System.Web.dll)
The parameters in the collection are associated with any parameters that are specified in the FilterExpression property. The parameter placeholders that are specified in the FilterExpression property are matched to parameter objects in the collection when the method specified by the SelectMethod property is called.
This section contains two code examples. The first 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 second code example provides an example of the middle-tier business object that is used in the first code example.
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 ObjectDataSource control can filter data only when the method that retrieves the data retrieves it as a DataSet object. For this reason, the SelectMethod property identifies a business object method that retrieves data as a DataSet.
The code example consists of a TextBox, a GridView control, the ObjectDataSource control, and a Submit button. By default, the TextBox is populated with the name of one of the Northwind Traders employees. The GridView displays information about the employee that is identified by the name in the TextBox. To retrieve data on another employee, in the TextBox, enter the full name of the employee, and then click the Submit button.
The FilterExpression property specifies an expression that is used to filter the data that is retrieved by the method specified by the SelectMethod property. It uses parameter placeholders that are evaluated to the parameters that are contained in the 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 required. The collection contains one parameter, a FormParameter that is bound to the TextBox control.
The following code example provides an example of a middle-tier business object that the preceding code example uses. The code example consists of two basic classes:
The EmployeeLogic class, which is a class that encapsulates business logic.
The NorthwindEmployee class, which is a model class that contains only the basic functionality that is required to load and persist data from the data tier.
For simplicity, the EmployeeLogic class creates a static set of data, rather than retrieving the data from a data tier. It is also helpful for this example, because the sample relies on you to provide the full name of a Northwind Traders employee to demonstrate filtering.
For a complete working example, you must compile and use these classes with the Web Forms page code examples that are provided.