I am saving/loading the layout but this doest keep which rows have been expanded/collapsed, is there an easy way to preserve this or should I listen for expand/collapse events and store their status myself so I can save/load them separately.
Hi,
No, there's no easy way to do this. The Layout does not include any row-specific properties, because this would mean saving the data. Obviously, it doesn't make any sense to save the data as part of the layout.
You would have to store this using some kind of key information for each row, because remember, the data might not be the same the next time you run the applicaiton and the Row objects certainly won't be the same objects.
OK, I don't normally use databound controls, I have created another table in my dataset to store information about the rows in my main employee table, whether they are expanded, selected, etc. Is there an easy way to find the primary key of the source row from the datagrid row object? Then I can link this to my own extended row properties table.
Hah, yeah Ok, I hid my PK as i didn't want to display it and so forgot it was still in the grid objects.
Ok cheers, just me being stupid.
You can just read the value of the appropriate cell once you have the row.
row.Cells["Primary Key"].Value
By the way the reason for needing this is that I have a tab control with many pages and they all use the same ultragrid control and I just change the datasource, I don't want viewing another tab and coming back to lose the expanded/collapsed status of the rows from the first datasource.