Anybody knows how can I clone or do a Deep Copy of a UltraGrid??
I make my own function to do it but .... the UltraGrid is not a serializable object and it craches :(
Although, if I can't clone that, I want to know if it's possible to extract only the data and put it on another UltraGrid. Can I extract the DataSource associated, clone it, and assign to a new UltraGrid?
Thanxs!
Thanks, exactly what I needed. I think, I guess now all I have to do is copy & paste another exact same datasource on my form and we are in business.
If you have two grids and they are both bound to data sources with identical structures, then you could save the DisplayLayout from the first grid and load it into the second using the save and load methods on the DisplayLayout.
Is it possible then, seeing as the grid has no clone function like many other objects do,
to be able to say save the displaylayout and the setup (no of columns, width etc...) to have an exact copy of the grid beside itself in a form,
by code only maybe like...
new grid()
grid.displaylayout = templategrid.displaylayout.save (which should return a displaylayout object)...
this is what i need to copy the grid as is, to display a diff set of data that is generated dynamically,
sort of like a copy & paste of the grid itself but in run time and not design time (forget about using the designer for this)
Thanks
Hi Alex,
Copying the data source has nothing to do with the grid, that would be entirely dependent on the data source. I'm pretty sure DataSet and DataTable have Clone methods, don't they?
What exactly are you trying to accomplish by cloning the grid? I don't think you can clone the entire grid object, but you can save the DisplayLayout of the grid (there are Save/Load methods on the object itself). This should cover any user-customizable properties in the grid. If you want to copy other settings, you might be able to do it using the PresetSerializer.