Hi Omar,
First Technique:
You can subclass GridListControl and override the CreateGridColumn member. A column is passed into this member as a parameter. Before calling the baseclass, modify this column in such a manner as to create the columns in the order you want to see them. So, for example, if you want to swap columns 1 & 2, then code such as this should do it.
public class MyGridListControl : GridListControl
{
public override void CreateGridColumn(PropertyDescriptor pd, int column)
{
if(column == 1)
column = 2;
else if(column == 2)
column = 1;
base.CreateGridColumn(pd, column);
}
}
Second Technique:
>>>>>>>>>>>>>>>>>>>>>>>>>
You can do this by handling the PrepareViewStyleInfo event of the Grid and set the cellValue using the Hashtable. This Hashtable store the column information of the gris. You can handle the events either at the form level, or the control level.Here is code snippet,
//Form''''s Load event
this gridListcontrol.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridControl grid = sender as GridControl;
if (hash.Contains(e.ColIndex))
{
if (hash[e.ColIndex] != null)
{
e.Style.CellValueType = grid[e.RowIndex, int.Parse(hash[e.ColIndex].ToString())].CellValueType;
e.Style.Text = grid[e.RowIndex, int.Parse(hash[e.ColIndex].ToString())].Text;
}
}
}
Here is a sample for implementing it.
http://www.syncfusion.com/Support/user/uploads/reorder_7dbe1840.zipBest regards,
Haneef