We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set a text and focus on form load in grid dynamic filter bar cell in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl
Tags: filtering

Customize the filter bar

In order to set the text and focus on FilterBarCell on form load, CurrentCell.Activate() method in DrawCellDisplayText events can be used.


// changing FilaterBar Display Text.
void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
   GridTableCellStyleInfo style =  this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex,        e.Inner.ColIndex);
    if (e.Inner.ColIndex == 1)
           if (style.TableCellIdentity.TableCellType == GridTableCellType.FilterBarCell)
               e.Inner.DisplayText = "Dyanmic Filter";
               //Activate the CurrentCell on the Filterbar cell using (RowIndex,ColIndex)
               e.TableControl.CurrentCell.Activate(e.Inner.RowIndex, e.Inner.ColIndex);



Dim condition As New FilterCondition(FilterCompareOperator.Like, "Sample data1")
' Add the Condition to the particular Column.
Dim rf As New RecordFilterDescriptor("Sample Test", condition)
' Add the RecordFilterDescriptor to the RecordFilters.
' changing FilaterBar Display Text.
Private Sub gridGroupingControl1_TableControlDrawCellDisplayText(ByVal sender As Object, ByVal e As GridTableControlDrawCellDisplayTextEventArgs)
   Dim style As GridTableCellStyleInfo =    Me.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex)
   If e.Inner.ColIndex = 1 Then
      If style.TableCellIdentity.TableCellType = GridTableCellType.FilterBarCell Then
         e.Inner.DisplayText = "Dynamic Filter"
          'Activate the CurrentCell on the Filterbar cell using (RowIndex,ColIndex)
           e.TableControl.CurrentCell.Activate(e.Inner.RowIndex, e.Inner.ColIndex)
      End If
   End If
End Sub




Before customize the filter bar cell in GridGroupingControl



After customize the filter bar cell in GridGroupingControl



C#: Customize FilterBar_CS

VB: Customize FilterBar_VB

Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/filtering#dynamic-filter

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile