How to clear data only from ultragrid..Keep other settings intact as they dont change and i dont want to apply the definition again and again..
Also, what exactly does sortedcolumns.clear do? can you give a specific example?
Thanks for your help
Hi,
What other settings are you referring to? You mean things like the column widths and positions?
The only way to clear the data from the grid is to remove it from the data source. So you would have to remove all of the rows from your data source. How you do that depends on what kind of DataSource you are using.
Another option would be to use the Save method on the grid's DisplayLayout, then set the grid's DataSource to null. This will destroy the layout, of course, but then you could re-load the layout from the save.
Sandeep D said:Also, what exactly does sortedcolumns.clear do? can you give a specific example?
When you sort a column in the grid (usually by clicking on the column header), the column is added to the SortedColumns collection. Clearing the collection will remove all columns from the collection and thus clear the sort indicator on every column in the band. Sorting is also tied to grouping. So if you are using OutlookGroupBy, the grouping would be cleared, as well.
Thanks for the reply!
I am binding the datagrid to an empty object instead of null and it now preserves the layout. Earlier , when i was putting the datasource as null then the layout was lost and even hidden columns were displayed.
While we are on groupby, can you advise how to do the following:
Group on a column when binding to datagrid. (i know this part)
and then within each group order by particular field (such as a date field) --> need help with this part
Thanks