Skip to main content

CardViewSettings.HeaderFilterFillItems Property

Enables you to add custom filter items in a filter dropdown.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public ASPxCardViewHeaderFilterEventHandler HeaderFilterFillItems { get; set; }

Property Value

Type Description
ASPxCardViewHeaderFilterEventHandler

An ASPxCardViewHeaderFilterEventHandler delegate method allowing you to implement custom processing.

Remarks

End users can use the header filter to filter column values. To invoke the filter dropdown, end user should click the filter button. The HeaderFilterFillItems event fires after the grid creates default filter items and before the grid shows the filter dropdown. Handle the HeaderFilterFillItems event to add custom filter items.

Run Demo: CardView - Header Filter

Note

  • You can use custom filter items to filter only the current column values.

  • The header filter supports HTML tags in item texts.

  • The HeaderFilterFillItems event does not fire if the BeforeHeaderFilterFillItems event’s Handled property is set to false.

@Html.DevExpress().CardView(
    settings => {
        settings.Name = "CardView";
        settings.Columns.Add("ProductName");
        settings.Columns.Add("UnitPrice").PropertiesEdit.DisplayFormatString = "c";
        //...
        settings.HeaderFilterFillItems = (sender, e) => {
            if (e.Column.FieldName != "UnitPrice") return;
            e.AddValue(String.Format("from {0} to {1}", 0, 100), string.Empty, String.Format("[UnitPrice] > {0} and [UnitPrice] < {1}", 0, 100));
            e.AddValue(String.Format(">= {0}", 100), string.Empty, String.Format("[UnitPrice] >= {0}", 100));
        }
 }).Bind(Model).GetHtml()

Result:

CardView - Custom Items in Header Filter

See Also