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

FilterValue.CreateShowAllValue(String) Method

Returns the (All) filter item used to clear filtering by a column’s values.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public static FilterValue CreateShowAllValue(
    string text
)

Parameters

Name Type Description
text String

A String value that specifies the item’s display text.

Returns

Type Description
FilterValue

Returns the filter item used to clear filtering.

Remarks

When handling the ASPxGridView.HeaderFilterFillItems event, you can also use the event parameter’s ASPxGridHeaderFilterEventArgs.AddShowAll method.

Example

protected void ASPxGridView1_HeaderFilterFillItems(object sender, 
DevExpress.Web.ASPxGridViewHeaderFilterEventArgs e)
{
    if (e.Column.FieldName != "FieldName") return;

    e.Values.Clear();

    // Example 1: Equals to 50
    FilterValue filterItem1 = new FilterValue();
    filterItem1.DisplayText = "Filter Value1";
    filterItem1.Value = "50";
    e.Values.Add(filterItem1);

    // Example 2: Equals to 100
    FilterValue filterItem2 = new FilterValue("Filter Value2", "100");
    e.Values.Add(filterItem2);

    // Example 3: Greater than 50
    FilterValue filterItem3 = 
    new FilterValue("> 50", null, string.Format("[FieldName] > {0}", 50));
    e.Values.Add(filterItem3);

    // Example 4: Clear Filtering
    FilterValue showAllItem = FilterValue.CreateShowAllValue("Show All");
    // FilterValue showAll = 
    //new FilterValue("Show All", null, FilterValue.FilterAllQuery);
    e.Values.Add(showAllItem);
}
See Also