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

Filter and DataGrid

How can I apply filter to rows of Datagrid?

3 Replies

AN Anatolii March 26, 2003 02:30 PM UTC

I was just looking for an answer to the same question. There is a GridFilterBar class, I was wondering if it uses some publicly accessible methods in GridDataBoundGrid to filter rows or does it modify the datasource on the grid directly?

Administrator March 28, 2003 09:07 AM UTC

If your Windows Forms DataGrid is bound ta a DataTable, say dt, then you can filter the displayed grid without changing its datasource, by setting the RowFilter property on the the defaultview of the datatable. dt.DefaultView.RowFilter = "[Col1] LIKE 'a*'"; This would show only rows whose entry in Col1 starts with an a.

Administrator January 10, 2006 06:33 PM UTC

Clay How can I filter my GDBG if the Grid is bounded to a business object not to a data table. Thanks Gk >If your Windows Forms DataGrid is bound ta a DataTable, say dt, then you can filter the displayed grid without changing its datasource, by setting the RowFilter property on the the defaultview of the datatable. > >dt.DefaultView.RowFilter = "[Col1] LIKE ''a*''"; > > >This would show only rows whose entry in Col1 starts with an a. >
Loader.
Live Chat Icon For mobile
Up arrow icon