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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GDBG LayoutColumns does not recreate column descriptors

Thread ID:





94523 May 19,2010 01:38 AM UTC May 26,2010 03:51 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On May 19, 2010 01:38 AM UTC

We are trying to create the code that modifies what columns are visible in GDBG based on the circumstances. To change the layout we use LayoutColumns(string [] {}) method.

It works fine first time (we hide a few columns)
Then when the second time we show some of the previously hidden columns, they appear empty and without column descriptors.

The only workaround we've found was to reapply grid DataSource, or rather recreate GridBoundColumns manually, since we have a lot of columns that are not data bound.

Is there a better way? Recreating columns from scratch is very inconvenient.

We tried this in .NET 1.1 (SF 3.0) and .NET 3.5 (SF 8.1)


DataTable table = new DataTable();
table.Rows.Add(new object [] {"A1", "B1", "C1"});
table.Rows.Add(new object [] {"A2", "B2", "C2"});
table.Rows.Add(new object [] {"A3", "B3", "C3"});

gridDataBoundGrid1.DataSource = table.DefaultView;

Syncfusion.Windows.Forms.Grid.GridHierarchyLevel hl = gridDataBoundGrid1.Binder.GetHierarchyLevel(0);

hl.LayoutColumns(new string[] {"A"});
hl.LayoutColumns(new string[] {"A", "B", "C"});

Christopher Issac Sunder K [Syncfusion]
Replied On May 26, 2010 03:51 AM UTC

Hi Jeck,

Thank you for your interest in Syncfusion products.
Regret for the delay. Please try using GridBoundColumns collection in GridDataBoundGrid to Show/Hide columns instead of LayoutColumns.

GridBoundColumnsCollection coll;
coll = this.gridDataBoundGrid1.Binder.InternalColumns.Clone() as GridBoundColumnsCollection;

//hiding columns
GridBoundColumnsCollection cool = coll.Clone() as GridBoundColumnsCollection;
this.gridDataBoundGrid1.GridBoundColumns = cool;

//showing columns
this.gridDataBoundGrid1.GridBoundColumns = coll;

Please refer the following sample which illustrates the above behavior in GridDataBoundGrid.


Let me know if you need any further clarifications.

Christopher K.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon