but how i come to know postion of cloumn at run time, if if change column position at

but how i come to know postion of cloumn at run time, if if change column position at


Hi Syncfusion.Grid.Grouping.Windows


but how i come to know postion of cloumn at run time, if if change column position

Note : i am changing position at run time when application running i drag my column from 3rd to 2nd so how i can pick postion then at unhide position i can move at that position not on original postion.





>Hi,

Use the VisibleColumns property of the GridTableDescriptor to show / hide / move the columns in the grid. Below is a code snippet

//For hide the "Col0" column
this.grid.TableDescriptor.VisibleColumns.Remove("Col0");

//For show the "Col0" column
this.grid.TableDescriptor.VisibleColumns.Add("Col0");

//For move columns in a grid.
this.grid.TableDescriptor.VisibleColumns.Move(1,2);

Best regards,
Haneef


2 Replies

HA haneefm Syncfusion Team May 17, 2007 06:51 PM UTC

Hi,

You can handle the TableControlQueryAllowDragColumn event to detect the drag column index at runtime. Below is a code snippet

void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
if (e.Reason == GridQueryAllowDragColumnReason.MouseUp)
{
int insertBeforFieldIndex = e.TableControl.TableDescriptor.NameToField(e.InsertBeforeColumn);
int insertBeforColIndex = e.TableControl.TableDescriptor.FieldToColIndex(insertBeforFieldIndex);
int FieldIndex = e.TableControl.TableDescriptor.NameToField(e.Column);
int ColIndex = e.TableControl.TableDescriptor.FieldToColIndex(FieldIndex);

Console.WriteLine(e.InsertBeforeColumn + "({0})" + ":::" + e.Column + "({1})", insertBeforColIndex, ColIndex);
}
}

Best regards,
Haneef


AS Ashok May 19, 2007 06:18 PM UTC


Thanks this code is working, but we can not store temp....


>Hi,

You can handle the TableControlQueryAllowDragColumn event to detect the drag column index at runtime. Below is a code snippet

void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
if (e.Reason == GridQueryAllowDragColumnReason.MouseUp)
{
int insertBeforFieldIndex = e.TableControl.TableDescriptor.NameToField(e.InsertBeforeColumn);
int insertBeforColIndex = e.TableControl.TableDescriptor.FieldToColIndex(insertBeforFieldIndex);
int FieldIndex = e.TableControl.TableDescriptor.NameToField(e.Column);
int ColIndex = e.TableControl.TableDescriptor.FieldToColIndex(FieldIndex);

Console.WriteLine(e.InsertBeforeColumn + "({0})" + ":::" + e.Column + "({1})", insertBeforColIndex, ColIndex);
}
}

Best regards,
Haneef

Loader.
Up arrow icon