开发者

Filtering in datagrid in .net

I have developed a Windows application which has one DataGrid. I am assigning Defaultview of on datatable as datasource to that datagrid.

Then after based on some filter criteria I derived a DataView from the DataGrid 's DataSource and then applying the filter to that view and then assigned that view to grid.

It works perfectly fine.

Now when i again populate that grid with the full set of data on refresh button after clearing data in the DataSource of the grid, th开发者_Python百科e filter condition is not cleared, it still persists.

So only subset of data is being displayed even though I have refreshed.

Please let me know how to clear the rowfilter while refreshing.....

Thanks......


To clear a filter on a DataView, set its RowFilter property to an empty string:

yourDataView.DefaultView.RowFilter = "";


First make the filter criteria to be assigned to a global variable, and on the Click of refresh button event handler, you assign some empty string to that global variable. This will surely solves your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜