aspnet-devexpress-dot-web-dot-aspxgridbase-d5f096dc.md
Allows you to replace the default criteria value editor with a custom editor.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public event FilterControlCriteriaValueEditorCreateEventHandler FilterControlCriteriaValueEditorCreate
Public Event FilterControlCriteriaValueEditorCreate As FilterControlCriteriaValueEditorCreateEventHandler
The FilterControlCriteriaValueEditorCreate event's data class is FilterControlCriteriaValueEditorCreateEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Column | Gets the column whose editor is being created. |
| EditorProperties | Gets or sets the processed editor properties. |
| Value | Gets or sets the processed editor value. |
The FilterControlCriteriaValueEditorCreate event fires for an editor in the criteria value, and enables you to replace the default editor with a custom editor.
To change the editor, use the event parameter’s EditorProperties property. The editor’s value is specified by the Value property.
protected void grid_FilterControlCriteriaValueEditorCreate(object sender, FilterControlCriteriaValueEditorCreateEventArgs e) {
if(e.Column.PropertyName == "NeedAlert") {
e.EditorProperties = CreateComboBoxProperties(e.Value);
}
}
EditPropertiesBase CreateComboBoxProperties(object value) {
bool v = value != null && (bool)value;
var props = new ComboBoxProperties();
props.ValueType = typeof(bool);
props.Items.Add(new ListEditItem("Need alert", true) { Selected = v });
props.Items.Add(new ListEditItem("Is's ok", false) { Selected = !v });
return props;
}
Protected Sub grid_FilterControlCriteriaValueEditorCreate(ByVal sender As Object, ByVal e As FilterControlCriteriaValueEditorCreateEventArgs)
If e.Column.PropertyName = "NeedAlert" Then
e.EditorProperties = CreateComboBoxProperties(e.Value)
End If
End Sub
Private Function CreateComboBoxProperties(ByVal value As Object) As EditPropertiesBase
Dim v As Boolean = value IsNot Nothing AndAlso DirectCast(value, Boolean)
Dim props = New ComboBoxProperties()
props.ValueType = GetType(Boolean)
props.Items.Add(New ListEditItem("Need alert", True) With {.Selected = v})
props.Items.Add(New ListEditItem("Is's ok", False) With {.Selected = Not v})
Return props
End Function
Run Demo: Grid - Filter ControlRun Demo: Card View - Filter ControlRun Demo: Vertical Grid - Filter Control
See Also