We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

61090 May 17,2007 02:20 PM May 19,2007 02:18 PM Windows Forms 2
loading
Tags: GridControl
Ashok
Asked On May 17, 2007 02:20 PM

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


haneefm [Syncfusion]
Replied On May 17, 2007 02:51 PM

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

Ashok
Replied On May 19, 2007 02:18 PM


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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;