FilterValue(String, String, String) Constructor
Initializes a new instance of the FilterValue class with the specified settings.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Parameters
Name | Type | Description |
---|---|---|
displayText | String | A String value that specifies the text displayed within the Header Filter. This value is assigned to the FilterValue.DisplayText property. |
value | String | A String value that specifies the filter item’s value. This value is assigned to the FilterValue.Value property. |
query | String | A String value that specifies the item’s filter expression. This value is assigned to the FilterValue.Query property. |
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