HA
haneefm
Syncfusion Team
June 12, 2007 09:04 PM UTC
Hi Roger,
For GroupingGrid:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
To programatically change the column position, you need to use the move method in GridTableDescriptor.VisibleColumns property. Below is a code snippet that show this.
//For move columns in a grid.
this.grid.TableDescriptor.VisibleColumns.Move(1,2);
For GridDataBoundGrid:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
To position the columns in the grid, you can use the Binder.LayoutColumns() method. This method rearranges how the columns should be displayed in the grid. Below is the code snippet.
If columns from datasource are populated as Col1, Col2, Col3, Col4, Col5 then you can modify the order of the columns like...
this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] {"Col1", "Col3", "Col5", "Col2", "Col4"});
You can also move columns in the DataBoundGrid, using the grid.Model.Cols.MoveRange method. See the code below,
// moves column 1 to 3
this.gridDataBoundGrid1.Model.Cols.MoveRange(1, 3);
Best regards,
Haneef