Skip to main content
Tab

ASPxGridHeaderFilterEventArgs.AddShowAll() Method

Adds the ‘All’ item to the header filter.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public void AddShowAll()

Example

The code sample below demonstrates how to provide custom header filter items using the ASPxVerticalGrid.BeforeHeaderFilterFillItems event. The ASPxGridBeforeHeaderFilterFillItemsEventArgs.AddValue method is used to create filter items. The ASPxGridBeforeHeaderFilterFillItemsEventArgs.Handled property is set to true to prevent the ASPxVerticalGrid.HeaderFilterFillItems event from being raised.

Note that the event fires before default items are created. If you would like to add custom items to default items, use the ASPxVerticalGrid.HeaderFilterFillItems event.

The image below shows the result.

ASPxCardView_Ex_BeforeHeaderFilterFillItems

protected void ASPxVerticalGrid1_BeforeHeaderFilterFillItems(object sender, DevExpress.Web.ASPxVerticalGridBeforeHeaderFilterFillItemsEventArgs e)
{
    if (e.Row.FieldName == "UnitPrice") {
        e.AddShowAll();
        int step = 20;
        var prop = new OperandProperty(e.Row.FieldName);
        for (int i = 0; i < 5; i++)
        {
            var start = step * i;
            var end = start + step;
            e.AddValue(string.Format("from {0:c0} to {1:c0}", start, end), prop >= start & prop < end);
        }
        e.AddValue(string.Format(">= {0:c0}", 100), prop >= 100);
        e.Handled = true;
    }
}
See Also