This demo illustrates the ability to generate database system-specific filter expressions using the DevExpress ASP.NET Filter Control (ASPxFilterControl). The ASPxFilterControl provides the following methods whose return values can be used as filter expressions ('WHERE' clauses) for the corresponding data source types:
In addition, the obtained filter expression can be validated for completeness using the IsFilterExpressionValid method, which is available both on the server and client sides. This method checks whether or not all expression conditions are filled, and indicates if it is safe to apply the expression.
In this demo, a standalone ASPxFilterControl is used to compose MS Sql-specific filter criteria. These criteria are applied to data that is obtained from an object using an ObjectDataSource, and displayed by an ASPxDataView control
The text of the filter expression being composed is displayed by a label below the ASPxFilterControl. If a filter expression is not valid, this is indicated by the corresponding label text.
Clicking the Apply button validates the current filter expression, generates filter criteria by the GetFilterExpressionForDataSet method call, and applies a filter expression to the data source control's FilterExpression property.