Skip to main content
Tab

FilterValue.DisplayText Property

Gets or sets the filter item’s display text.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public string DisplayText { get; set; }

Property Value

Type Description
String

A String value that specifies the item’s text displayed within the Header Filter.

Remarks

You can also specify the filter item’s display text within the constructor, when initializing a new instance of the FilterValue class.

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