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.

Hi want Hide and unhide feature but dynamically if i change position at runtime and hide then after unhide column should appear on same position from where i hide not at initial postion

Thread ID:

Created:

Updated:

Platform:

Replies:

61073 May 16,2007 10:33 PM May 17,2007 02:51 PM Windows Forms 3
loading
Tags: GridControl
Ashok
Asked On May 16, 2007 10:33 PM

Hi i am using Syncfusion.Grid.Grouping.Windows


Hi want Hide and unhide feature but dynamically if i change position at runtime and hide then unhide same column should appear on same position from where i hide not at initial postion.

Example:
as an example i change position of "Type" column from third to second position and hide, if i unhide column this should appear at second position not.

Right Click on header0.zip

haneefm [Syncfusion]
Replied On May 17, 2007 01:46 PM

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

Ashok
Replied On May 17, 2007 01:59 PM

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

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.

;