Skip to main content
A newer version of this page is available. .
Tab

ASPxCardView.HeaderFilterFillItems Event

Enables you to add custom filter items which filter data by the current column, to ones displayed within a Header Filter.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

public event ASPxCardViewHeaderFilterEventHandler HeaderFilterFillItems

Event Data

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

Property Description
Column Gets the data column currently being filtered.
Values Gets a collection that contains the header filer values. Inherited from ASPxGridHeaderFilterEventArgs.

The event data class exposes the following methods:

Method Description
AddShowAll() Adds the ‘All’ item to the header filter. Inherited from ASPxGridHeaderFilterEventArgs.
AddShowBlanks(String) Creates and adds the “Blanks” filter value to the header filter values. Inherited from ASPxGridHeaderFilterEventArgs.
AddShowNonBlanks(String) Creates and adds the “(Non blanks)” filter value to the header filter values. Inherited from ASPxGridHeaderFilterEventArgs.
AddValue(String, String, String) Adds a new filter item with the specified filter criteria to the header filter. Inherited from ASPxGridHeaderFilterEventArgs.
AddValue(String, String) Adds a new filter item to the header filter. Inherited from ASPxGridHeaderFilterEventArgs.
CreateShowBlanksValue(String) Creates and returns the (Blanks) filter item used to filter a column by blank values. Inherited from ASPxGridHeaderFilterEventArgs.
CreateShowNonBlanksValue(String) Creates and returns the (Non blanks) filter item used to filter a column by blank values. Inherited from ASPxGridHeaderFilterEventArgs.

Remarks

End-users can filter column values using the Header Filter. To invoke the filter dropdown, an end-user should click the filter button. The HeaderFilterFillItems event is raised after default filter items are created and before the filter dropdown is shown; and enables you to add custom filter items.

Note

The custom filter items can be used for filtering data by the current column only.

The data column whose filter button has been clicked is returned by the ASPxCardViewHeaderFilterEventArgs.Column property. The list of filter values can be accessed using the ASPxGridHeaderFilterEventArgs.Values property. To add a new filter value, use the ASPxGridHeaderFilterEventArgs.AddValue method.

To build complex filter expressions, use the Filter Control.

Note

ASPxCardView header filter allows the use of HTML tags in an item text. To learn more, see Header Filter.

Note

If the ASPxGridBeforeHeaderFilterFillItemsEventArgs.Handled property is set to true, the HeaderFilterFillItems event is not raised.

Example

This example shows how to create custom filter items and display them within the Quantity column’s filter dropdown.

The image below shows the result:

ASPxCardView_Ex_HeaderFilterFillItems

protected void CardView_HeaderFilterFillItems(object sender, ASPxCardViewHeaderFilterEventArgs e)
{
    if (e.Column.FieldName != "Quantity") return;
    e.AddValue("nonzero", string.Empty, "[Quantity] != 0");
    e.AddValue(String.Format("from {0} to {1}", 0, 50), string.Empty, String.Format("[Quantity] > {0} and [Quantity] < {1}", 0, 50));
    e.AddValue(String.Format(">= {0}", 50), string.Empty, String.Format("[Quantity] >= {0}", 50));
}
See Also