Hi,
How can I re-arrange my columns from code ? My grid is unbound and I am binding it on the fly using grid.datasource = mydatasourcetable. Here my data source table has columns in the order different than I want them on the grid. How can I re-arrange them?
thanks,
Yogesh
In the initialize layout method I use the followng code to set up the columns. This loops through all the columns in the grid and sets the values I want. Use the visible position to set the column location. Column numbering starts at 0. Sometimes it take a bit of effort to get it just right. I have had to skip a number and go to the next higher at times to make it order correctly.
Dim aColumn As UltraGridColumn
aColumn.Header.Caption =
"Select"
aColumn.Header.VisiblePosition = 0
aColumn.Width = 59
aColumn.DataType =
GetType(Boolean)
aColumn.AllowGroupBy = DefaultableBoolean.False
aColumn.Header.Fixed =
True
aColumn.Header.VisiblePosition = 1
"Company Name"
aColumn.CellAppearance.TextHAlign = HAlign.Left
aColumn.Header.Appearance.TextHAlign = HAlign.Center
aColumn.ExcludeFromColumnChooser = ExcludeFromColumnChooser.False
'aColumn.DataType = GetType(String)
"Input date"
aColumn.Header.VisiblePosition = 3
aColumn.Width = 70
"Home Phone"
aColumn.MaskInput =
"(###) ###-####"
aColumn.MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.Raw
aColumn.MaskClipMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth
aColumn.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth
aColumn.Header.VisiblePosition = 12
aColumn.Hidden =
aColumn.ExcludeFromColumnChooser = ExcludeFromColumnChooser.True
End Select
Next