Skip to main content

SqlDataSource.CustomizeFilterExpression Event

Allows you to include WHERE clauses in SQL queries.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v23.2.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

public event CustomizeFilterExpressionEventHandler CustomizeFilterExpression

Event Data

The CustomizeFilterExpression event's data class is CustomizeFilterExpressionEventArgs. The following properties provide information specific to this event:

Property Description
FilterExpression Gets or sets the filter expression that defines a WHERE clause included in the SQL query.
QueryName Gets the name of the query for which the event was raised.

Remarks

The CustomizeFilterExpression event is fired when the SqlDataSource sends a query to reload data from the server (for instance, on the SqlDataSource.Fill method call). Use the event parameter’s CustomizeFilterExpressionEventArgs.FilterExpression property to specify a filter expression to be included in this query as a WHERE clause.

The filter expression should be represented by the CriteriaOperator descendant. To learn how to create the appropriate object, see Simplified Criteria Syntax. Use the CustomizeFilterExpressionEventArgs.QueryName property to identify the query for which the event has been raised.

Note

The CustomizeFilterExpression event is fired only for queries represented by the SelectQuery or TableQuery classes.

You can also handle the SqlDataSource.ConfigureDataConnection event to specify connection parameters on the fly.

See Also