ASPxGridView.AutoFilterByColumn(GridViewColumn, String) Method
Applies a filter to the specified data column.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
column | GridViewColumn | A GridViewColumn descendant that represents the data column within the ASPxGridView. |
value | String | A String value that specifies the filter string. |
Remarks
Use the AutoFilterByColumn method to filter data in code.
The method call creates a filter condition based on the value parameter. This filter is then applied to the ASPxGridView. The comparison operator used in this filter condition is determined by the column’s GridViewDataColumnSettings.AutoFilterCondition property.
End-users can apply a filter via the Filter Row which is displayed when the ASPxGridViewSettings.ShowFilterRow option is enabled.
Note
String values that are passed via the value parameter and are supposed to be handled as numeric or DateTime values must be represented in the Invariant Culture format (see CultureInfo.InvariantCulture Property to learn more).
To learn more, see Filtering.
Example
The following example demonstrates how to apply a filter to a column and display the filter expression within the grid’s Title Panel.
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<dx:GridViewDataTextColumn FieldName="Department" />
<dx:GridViewDataTextColumn FieldName="Location" />
<dx:GridViewDataTextColumn FieldName="Budget" />
</Columns>
<Settings ShowTitlePanel="true" />
</dx:ASPxGridView>
ASPxGridView1.DataColumns["Department"].Settings.AutoFilterCondition = AutoFilterCondition.EndsWith;
ASPxGridView1.AutoFilterByColumn(ASPxGridView1.Columns["Department"], "development");
ASPxGridView1.SettingsText.Title = ASPxGridView1.FilterExpression;
The image below shows the result: