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
close icon

GridGrouping - How to hide the column?

hi!

how to hide a specific column of the grid?
I want to get the value of the hidden column when user click on any cell of the row.

My grid is allowed to Group.

Thanks!

3 Replies

AD Administrator Syncfusion Team September 13, 2006 09:08 AM UTC

Hi Lim,

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);

To get the value of the hidden column, you need to call the Record.GetValue method in TablecontrolCellClick event.

GridRecordRow recRow = e.TableControl.Table.DisplayElements[e.Inner.RowIndex] as GridRecordRow;
if(recRow != null)
{
Console.WriteLine(recRow.ParentRecord.GetValue("Col0") );
}


Thanks,
Haneef


QU QLT User February 10, 2016 02:55 PM UTC

how do i move the column if i dont know its current position ? is there a way to get its current position and then use variables in the move method ?


PK Pavithra Kodiyarasan Syncfusion Team February 11, 2016 12:05 PM UTC

Dear Customer,

Thank you for contacting Syncfusion Support.

You can get current position of the column by using IndexOf() method and move the column by Move() method. Please find the Code example and sample below.

Code Example:

int columnindex = this.gridGroupingControl1.TableDescriptor.Columns.IndexOf("Name"); //get the Column index of column "Name"

this.gridGroupingControl1.TableDescriptor.Columns.Move(columnindex, 0); //Move the column to zero index.

Sample:


http://www.syncfusion.com/downloads/support/forum/49197/ze/WindowsFormsApplication1-63976165 


Regards,

Pavithra K.


Loader.
Live Chat Icon For mobile
Up arrow icon