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. (Last updated on: November 16, 2018).
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?


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



Article ID: Published Date: Last Revised Date: Platform: Control:
465 04/30/2011 07/10/2014 WinForms GridDataBoundGrid(Classic)
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

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

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