ADAdministrator Syncfusion Team July 15, 2005 11:11 AM UTC
If you do not want to remove it from the DataTable, then you will have to do some work depending on what you need.
If you are not sorting the grid, then you can hide the row using code like:
grid.Model.RowHeights[rowIndex] = 0;
If you want to sort, then hiding the row as above does not keep the row hidden when you sort it and a new row might get hidden as it moves to the row whose height is zero. In this case, one way you can hide a row is to filter it out of teh DataTable using Datatable.DefaultView.RowFilter. This means you would have to write a filter that included only the rows you want visible. This may or may not be simple depending on what rows you are trying to remove.
Another option is to handle teh grid.Model.QueryRowHeight, and if e.Index points to a row you want deleted, then you can set e.handled = true and e.Size = 0. To handle sorts, you would want to use e.Index - 1 as an index into the DataView associated with the grid. Then you could check a primary key value in teh DataRowView to see if this is a row you want hidden.
CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager;
DataView dv = cm.List as DataView;
DataRowView drv = dv[e.Index-1];
if((int)drv["pkCol"] == 18)
e.Handled = true;
e.Size = 0;