Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SqlDataSource::FilterParameters Property

 

Gets a collection of parameters that are associated with any parameter placeholders that are in the FilterExpression string.

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

public:
[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
property ParameterCollection^ FilterParameters {
	ParameterCollection^ get();
}

Property Value

Type: System.Web.UI.WebControls::ParameterCollection^

A ParameterCollection that contains a set of parameters associated with any parameter placeholders found in the FilterExpression property.

The parameters in the FilterParameters 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 by order to parameter objects in the FilterParameters collection when the Select method is called.

The FilterParameters property retrieves the FilterParameters property that is contained by the SqlDataSourceView object that is associated with the SqlDataSource control.

System_CAPS_security Security Note

Values are inserted into parameters without validation, which is a potential security threat. Use the Filtering event to validate parameter values before executing the query. For more information, see Script Exploits Overview.

The following code example demonstrates how to retrieve data from the Northwind database and filter it using the FilterExpression and FilterParameters properties. The FilterExpression property of the SqlDataSource control is applied anytime the Select method is executed to retrieve data. In this example, the FilterExpression property contains a placeholder for a filter parameter, which is contained in the FilterParameters collection. In addition, the filter parameter is a ControlParameter object that is bound to the SelectedValue property of the DropDownList control. Because the DropDownList control has its AutoPostBack property set to true, any change in the DropDownList selection causes the page to post information back to the server and the GridView control to rebind to the data source control with the new filter.

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

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft