AD
Administrator
Syncfusion Team
August 24, 2006 05:19 AM UTC
Hi Vijay,
Use the TableDescriptor.Columns property to manages column descriptors in the grid. It allows you to add and remove columns, moves column at specific position. Below the code snippet.
//Form Load event.
int index = this.gridGroupingControl1.TableDescriptor.NameToField("ColumnName");
this.gridGroupingControl1.TableDescriptor.Columns.Move(index,0);
this.gridGroupingControl1.TableDescriptor.Columns.Changed +=new Syncfusion.Collections.ListPropertyChangedEventHandler(Columns_Changed);
private void Columns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if( e.Action == Syncfusion.Collections.ListPropertyChangedType.Move )
{
GridColumnDescriptorCollection columns = sender as GridColumnDescriptorCollection;
if( columns != null && columns[0].Name != "ComboList")
{
columns.Changed -=new Syncfusion.Collections.ListPropertyChangedEventHandler(Columns_Changed);
GridColumnDescriptor col = columns[ "ColumnName" ];
columns.Remove("ColumnName");
columns.Insert(0,col);
columns.Changed +=new Syncfusion.Collections.ListPropertyChangedEventHandler(Columns_Changed);
}
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/Columns_e2b32cee.zip
Let me know if this is not what you wanted.
Best Regards,
Haneef