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. Image for the cookie policy date

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

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

3 Replies

HA haneefm Syncfusion Team May 17, 2007 05:46 PM UTC

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


AS Ashok May 17, 2007 05:59 PM UTC

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


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

Loader.
Live Chat Icon For mobile
Up arrow icon