when a user sees a grid, he can change column width, column order , etc.
I want to save this user definitions, so that when the user comes again to the same grid,
he will see the grid with his definitions. ( same column widths, column order etc.)
Search the online help for DisplayLayout Save
There are some code snippets there that will give you an idea of what may be done. I save the layout myself to a SQL dtabase table inside a column of type Image. You may also find some code in the knowledge base for doing that. Unfortunately mine is very obscure by using a DAL and not an easy example to provide.
Nick
I am inheriting the grid and making my own custom grid, which automatically saves user definitions.
on which events of the grid you think should it be best to save and load the definitions?
( It should not be done from the events of the form, because I dont want to depend on the form I use)
The InitializeLayout event is usually a good place to load the layout. In your case, I would probably load the layout before calling the base implementation. That way, when the user handles the event, he can change anything that was loaded.
I'm not sure when you would save. Maybe in the OnDispose before the grid is disposed? That might not be a good idea, though, because I guess the DataSource may already be disposed at that point.