Back to Devexpress

GridViewDataColumnSettings.AutoFilterCondition Property

aspnet-devexpress-dot-web-dot-gridviewdatacolumnsettings-4399d5ad.md

latest6.7 KB
Original Source

GridViewDataColumnSettings.AutoFilterCondition Property

Specifies the type of comparison operator used by filter row to create filter conditions for the current column.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(AutoFilterCondition.Default)]
public AutoFilterCondition AutoFilterCondition { get; set; }
vb
<DefaultValue(AutoFilterCondition.Default)>
Public Property AutoFilterCondition As AutoFilterCondition

Property Value

TypeDefaultDescription
AutoFilterConditionDefault

An AutoFilterCondition enumeration value that specifies the comparison operator type.

|

Available values:

Show 12 items

NameDescription
Default

For the string columns and columns that are filtered by display text - the same as the BeginsWith value. For other columns - the Equals value.

| | BeginsWith |

Selects records whose values in the corresponding colum begin with the entered value.

| | EndsWith |

Selects records whose values in the corresponding colum end with the entered value.

| | Contains |

Selects records whose values in the corresponding colum contain the entered value.

| | DoesNotContain |

Selects records whose values in the corresponding colum don’t contain the entered value.

| | Equals |

Selects records whose values in the corresponding column match the entered value.

| | Less |

Selects records whose values in the corresponding column are less than the entered value.

| | LessOrEqual |

Selects records whose values in the corresponding column are less than or equal to the entered value.

| | Greater |

Selects records whose values in the corresponding column are greater than the entered value.

| | GreaterOrEqual |

Selects records whose values in the corresponding column are greater than or equal to the entered value.

| | NotEqual |

Selects records whose values in the corresponding column are not equal to the entered value.

| | Like |

Selects records whose values in the corresponding column match the entered mask. Two wildcard symbols are supported: ‘%’ substitutes zero or more characters; ‘_’ substitutes a single character.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AutoFilterCondition
GridViewDataColumn

.Settings .AutoFilterCondition

|

Remarks

When an end user types text in the filter row‘s cell or when the ASPxGridView.AutoFilterByColumn method is called, a filter condition is created based upon the value entered. This filter is then applied to the ASPxGridView. The comparison operator used in this filter condition is determined by the column’s AutoFilterCondition property.

If the AutoFilterCondition property is set to Default , the column’s comparison operator type is controlled by the ASPxGridView’s ASPxGridViewSettings.AutoFilterCondition property.

Example

The following example illustrates how to use the AutoFilterCondition property.

Web Forms approach:

Note

For a full example, see the ASPxGridView - Customization Dialog demo.

aspx
<dx:ASPxGridView ID="Grid" runat="server" DataSourceID="ProductsDataSource" 
    EnableRowsCache="false" Width="100%">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="ProductName">
            <Settings AutoFilterCondition="Contains" />
        </dx:GridViewDataTextColumn>
        <dx:GridViewDataComboBoxColumn FieldName="CategoryID" Caption="Category Name" SortIndex="0" SortOrder="Ascending" AdaptivePriority="1">
            <PropertiesComboBox DataSourceID="CategoriesDataSource" ValueField="CategoryID" TextField="CategoryName" ValueType="System.Int32" />
            <Settings AllowHeaderFilter="True" AllowAutoFilter="False" SortMode="DisplayText" />
            <SettingsHeaderFilter Mode="CheckedList" />
        </dx:GridViewDataComboBoxColumn>
        ...
    </Columns>
</dx:ASPxGridView>

MVC approach:

Note

For a full example, see the GridView - Customization Dialog demo.

cshtml
@Html.DevExpress().GridView(settings => {
    settings.Name = "GridView";
    settings.SettingsCustomizationDialog.Enabled = true;
    ...
    settings.Columns.Add(c => {
        c.FieldName = "ProductName";
        c.Settings.AutoFilterCondition = AutoFilterCondition.Contains;
    });
    settings.Columns.Add(c => {
        c.FieldName = "CategoryID";
        c.Caption = "Category Name";
        c.SortIndex = 0;
        c.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
        c.AdaptivePriority = 1;
        c.Settings.AllowHeaderFilter = DefaultBoolean.True;
        c.Settings.AllowAutoFilter = DefaultBoolean.False;
        c.Settings.SortMode = DevExpress.XtraGrid.ColumnSortMode.DisplayText;
        c.SettingsHeaderFilter.Mode = GridHeaderFilterMode.CheckedList;
        c.EditorProperties().ComboBox(cb => {
            cb.DataSource = NorthwindDataProvider.GetCategories();
            cb.TextField = "CategoryName";
            cb.ValueField = "CategoryID";
            cb.ValueType = typeof(int);
        });
    });
}).Bind(Model).GetHtml()

See Also

AutoFilterCondition

FilterMode

Filter Row

Grid View

GridViewDataColumnSettings Class

GridViewDataColumnSettings Members

DevExpress.Web Namespace