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

Show specific columns from a bounded datatable

How do a show specific columns from a datatable bound to a ggc?
For example, if a datatable (dt) has col1, col2, and col2

and the ggc is bound to the datatable (dt) like
ggc.DataSource = dt;

How do I show only col1 and col 3 in the grid?

1 Reply

AD Administrator Syncfusion Team September 6, 2006 10:38 AM UTC

Hi James,

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

Thanks,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon