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 do I make my filter bar use textboxes and have the display respond to each keystroke?

Platform: WinForms |
Control: GridDataBoundGrid(Classic)


To get Textbox filtering, you can derive the GridFilterBar class and handle the CurrentCellChanged event handler. Below is the code snippet:


public class GridTextBoxFilterBar : GridFilterBar


private GridDataBoundGrid _grid;

private DataTable _dataTable;

private DataSet ds;

public override void WireGrid(Syncfusion.Windows.Forms.Grid.GridDataBoundGrid grid,

Syncfusion.Windows.Forms.Grid.GridStyleInfo style)


if(_grid != null)


if(grid != null)


_dataTable = grid.DataSource as DataTable;

if(_dataTable == null)


ds = grid.DataSource as DataSet;

if(ds != null)


_dataTable = ds.Tables[grid.DataMember];



if(_dataTable != null)


//add a fixed row at the top



int _row = grid.Model.Rows.HeaderCount;

grid.Model.Rows.FrozenCount = grid.Model.Rows.FrozenCount + 1;

grid.Model.ChangeCells(GridRangeInfo.Cells(_row, 1, _row, grid.Model.ColCount), style, StyleModifyType.Override);

GridBorder border = grid.BaseStylesMap["Standard"].StyleInfo.Borders.Right;

for(int col = 1; col <= grid.Model.ColCount; ++col)


grid[_row, col].Borders.Right = border;


grid.CurrentCellChanged += new EventHandler(grid_FilterCellChanged);



_grid = grid;




Public Class GridTextBoxFilterBar : Inherits GridFilterBar

Private _grid As GridDataBoundGrid

Private _dataTable As DataTable

Private ds As DataSet

Public overloads Overrides Sub WireGrid(ByVal grid As Syncfusion.Windows.Forms.Grid.GridDataBoundGrid, ByVal style As


If Not _grid Is Nothing Then


End If

If Not grid Is Nothing Then

_dataTable = CType(IIf(TypeOf grid.DataSource Is DataTable, grid.DataSource, Nothing), DataTable)

If _dataTable Is Nothing Then

ds = CType(IIf(TypeOf grid.DataSource Is DataSet, grid.DataSource, Nothing), DataSet)

If Not ds Is Nothing Then

_dataTable = ds.Tables(grid.DataMember)

End If

End If

If Not _dataTable Is Nothing Then

'add a fixed row at the top

grid.Model.Data.RowCount += 1

grid.Model.Rows.HeaderCount += 1

Dim _row As Integer = grid.Model.Rows.HeaderCount

grid.Model.Rows.FrozenCount = grid.Model.Rows.FrozenCount + 1

grid.Model.ChangeCells(GridRangeInfo.Cells(_row, 1, _row, grid.Model.ColCount), style, StyleModifyType.Override)

Dim border As GridBorder = grid.BaseStylesMap("Standard").StyleInfo.Borders.Right

Dim col As Integer = 1

Do While col <= grid.Model.ColCount

grid(_row, col).Borders.Right = border

col += 1


AddHandler grid.CurrentCellChanged, AddressOf grid_FilterCellChanged

End If

End If

_grid = grid

End Sub

End Class



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