'Declaration Public Event BeforeRowFilterDropDown As BeforeRowFilterDropDownEventHandler
public event BeforeRowFilterDropDownEventHandler BeforeRowFilterDropDown
The event handler receives an argument of type BeforeRowFilterDropDownEventArgs containing data related to this event. The following BeforeRowFilterDropDownEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | |
Column | Column associated with the column header flter drop down button was clicked on. |
Rows | If UltraGridOverride.RowFilterMode resolves to SiblingRowsOnly, then the RowsCollection associated with the column header that the filter dropdown button is clicked on will be passed in. Otherwise it will be null. |
ValueList | The contents of the filter drop down as a ValueList. You can add or remove items from this ValueList. |
You can use the BeforeRowFilterDropDown event to cancel the drop down.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout e.Layout.Override.AllowRowFiltering = DefaultableBoolean.True End Sub Private Sub UltraGrid1_BeforeRowFilterDropDown(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowFilterDropDownEventArgs) Handles UltraGrid1.BeforeRowFilterDropDown ' You can modify the ValueList in the event args. Following for loop removes ' Custom and Blanks items from the value list. Dim i As Integer For i = e.ValueList.ValueListItems.Count - 1 To 0 Step -1 ' Remove Custom option from the filter drop down. If e.ValueList.ValueListItems(i).DisplayText.Equals("(Custom)") Then e.ValueList.ValueListItems.RemoveAt(i) End If ' Remove Blanks option from the filter drop down. If e.ValueList.ValueListItems(i).DisplayText.Equals("(Blanks)") Then e.ValueList.ValueListItems.RemoveAt(i) End If Next If GetType(String) Is e.Column.DataType Then Dim condition As FilterCondition ' You can add items with custom criteria as well by using FilterCondition object ' as the DataValue of the value list item. condition = New FilterCondition(e.Column, FilterComparisionOperator.Match, "^[A-Ha-h]") e.ValueList.ValueListItems.Insert(0, condition, "A to H") condition = New FilterCondition(e.Column, FilterComparisionOperator.Match, "^[I-Pi-p]") e.ValueList.ValueListItems.Insert(1, condition, "I to P") condition = New FilterCondition(e.Column, FilterComparisionOperator.Match, "^[Q-Zq-z]") e.ValueList.ValueListItems.Insert(2, condition, "Q to Z") End If If GetType(Integer) Is e.Column.DataType Then Dim conditions As ColumnFilter ' You can also add items with custom criteria by using ColumnFilter object ' as the DataValue of the value list item. conditions = New ColumnFilter(e.Column, FilterLogicalOperator.And) conditions.FilterConditions.Add(FilterComparisionOperator.LessThan, 50) e.ValueList.ValueListItems.Insert(0, conditions, "49 and below") conditions = New ColumnFilter(e.Column, FilterLogicalOperator.And) conditions.FilterConditions.Add(FilterComparisionOperator.GreaterThanOrEqualTo, 50) conditions.FilterConditions.Add(FilterComparisionOperator.LessThan, 100) e.ValueList.ValueListItems.Insert(0, conditions, "50 to 99") conditions = New ColumnFilter(e.Column, FilterLogicalOperator.And) conditions.FilterConditions.Add(FilterComparisionOperator.GreaterThanOrEqualTo, 100) e.ValueList.ValueListItems.Insert(0, conditions, "100 and above") End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.AllowRowFiltering = DefaultableBoolean.True; } private void ultraGrid1_BeforeRowFilterDropDown(object sender, Infragistics.Win.UltraWinGrid.BeforeRowFilterDropDownEventArgs e) { // You can modify the ValueList in the event args. Following for loop removes // Custom and Blanks items from the value list. for ( int i = e.ValueList.ValueListItems.Count - 1; i >= 0; i-- ) { // Remove Custom option from the filter drop down. if ( e.ValueList.ValueListItems[i].DisplayText.Equals( "(Custom)" ) ) e.ValueList.ValueListItems.RemoveAt( i ); // Remove Blanks option from the filter drop down. if ( e.ValueList.ValueListItems[i].DisplayText.Equals( "(Blanks)" ) ) e.ValueList.ValueListItems.RemoveAt( i ); } if ( typeof( string) == e.Column.DataType ) { FilterCondition condition; // You can add items with custom criteria as well by using FilterCondition object // as the DataValue of the value list item. condition = new FilterCondition( e.Column, FilterComparisionOperator.Match, "^[A-Ha-h]" ); e.ValueList.ValueListItems.Insert( 0, condition, "A to H" ); condition = new FilterCondition( e.Column, FilterComparisionOperator.Match, "^[I-Pi-p]" ); e.ValueList.ValueListItems.Insert( 1, condition, "I to P" ); condition = new FilterCondition( e.Column, FilterComparisionOperator.Match, "^[Q-Zq-z]" ); e.ValueList.ValueListItems.Insert( 2, condition, "Q to Z" ); } if ( typeof( int ) == e.Column.DataType ) { ColumnFilter conditions; // You can also add items with custom criteria by using ColumnFilter object // as the DataValue of the value list item. conditions = new ColumnFilter( e.Column, FilterLogicalOperator.And ); conditions.FilterConditions.Add( FilterComparisionOperator.LessThan, 50 ); e.ValueList.ValueListItems.Insert( 0, conditions, "49 and below" ); conditions = new ColumnFilter( e.Column, FilterLogicalOperator.And ); conditions.FilterConditions.Add( FilterComparisionOperator.GreaterThanOrEqualTo, 50 ); conditions.FilterConditions.Add( FilterComparisionOperator.LessThan, 100 ); e.ValueList.ValueListItems.Insert( 0, conditions, "50 to 99" ); conditions = new ColumnFilter( e.Column, FilterLogicalOperator.And ); conditions.FilterConditions.Add( FilterComparisionOperator.GreaterThanOrEqualTo, 100 ); e.ValueList.ValueListItems.Insert( 0, conditions, "100 and above" ); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2