I have a number of grids which will all have the same columns. Is it possible to set up the columns for one grid at design time, then "add" the columns from this grid to the other grids when the form loads? I have been looking for something like UltraGridColumn.Clone but to no avail, or
Dim newCol as UltraGridColumn = grid1.DisplayLayout.Bands(0).Columns(0).Clonegrid2.DisplayLayout.Bands(0).Columns.Add(newCol)
Any ideas?
TIA
Hello,
I think that in this scenario you could work with “Presets”. On the next link you would be able to find the Mike’s post, where he explained how to set a Preset as default for your grids.
http://community.infragistics.com/forums/t/55373.aspx
Also please look at the next links, which will guide you through Presets:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2010.3/CLR2.0/html/Win_Working_with_Presets.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2010.3/CLR2.0/html/WinGrid_Default_Design_Time_Look.html
Let me know if you have any further questions.
Thx for the reply Hristo,
What I'm looking for is a way to copy a copy of a column from one grid to another. That means that the ColumnName, DataType, Key,etc. would be the same. The original column definition would act as a template for the new column in the other grid.
Dave
It turns out that Grid1.DisplayLayout.SaveAsXml (memoryStream, PropertyCategories.All), followed by Grid2.DisplayLayout.LoadFromXml(memoryStream, PropertyCategories.All) did the trick. The setup of Grid2, including columns, is identical with Grid1.
Hi,
I just wanted to know if you were able to solve your issue based on Mike's suggestions or you still need help? Just let me know.
Thank you.
Hi Dave,
As long as the two grids have the same data source (or at least the same structure), then saving and loading the layout is the way to go. :)