Tab

ASPxFilterControlBase.OperationVisibility Event

Enables you to hide/show the operations for filterable properties within the control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

public event FilterControlOperationVisibilityEventHandler OperationVisibility
Public Event OperationVisibility As FilterControlOperationVisibilityEventHandler

Event Data

The OperationVisibility event's data class is FilterControlOperationVisibilityEventArgs. The following properties provide information specific to this event:

Property Description
Operation Gets the comparison operator type.
PropertyInfo Gets the filterable property of the filter expression.
Visible Gets or sets a value specifying whether the filter operation is visible.

Remarks

The OperationVisibility event is raised for each comparison operator, and allows you to dynamically control its visibility.

The event parameter's FilterControlOperationVisibilityEventArgs.PropertyInfo and the FilterControlOperationVisibilityEventArgs.Operation properties identify the filterable property (the column being filtered) and its operations. To specify the operator's visibility, use the FilterControlOperationVisibilityEventArgs.Visible property.

Examples

Starting with v2010 vol 1. it is possible to hide filter operation items (Contains, Equals, etc.). In the OperationVisibility event handler, a database field name is analyzed, and based on custom conditions, unnecessary operations are hidden.

View Example: https://github.com/DevExpress-Examples/how-to-hide-filter-operation-items-e2218

<dx:ASPxFilterControl ID="filter" runat="server" ClientInstanceName="filter" OnOperationVisibility="filter_FilterOperationVisibility">
    <Columns>
        <dx:FilterControlSpinEditColumn PropertyName="CategoryID" />
        <dx:FilterControlTextColumn PropertyName="CategoryName" />
        <dx:FilterControlTextColumn PropertyName="Description" />
    </Columns>
    <ClientSideEvents Applied="function(s, e) { grid.ApplyFilter(e.filterExpression);}" />
</dx:ASPxFilterControl>
...
<dx:ASPxButton runat="server" ID="btnApply" Text="Apply" AutoPostBack="false" UseSubmitBehavior="false">
    <ClientSideEvents Click="function() { filter.Apply(); }" />
</dx:ASPxButton>
...
<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" DataSourceID="AccessDataSource1"
    KeyFieldName="CategoryID" Width="100%" AutoGenerateColumns="False">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="CategoryID" VisibleIndex="0" />
        <dx:GridViewDataTextColumn FieldName="CategoryName" VisibleIndex="1" />
        <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="2" />
    </Columns>
</dx:ASPxGridView>

<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
    SelectCommand="SELECT * FROM [Categories]" />
See Also