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

Layout Columns


Hi,

I use this code to reorder the columns:

this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] {"Col1", "Col2", "Col3", "Col4", "Col5"});


Then, I purposely leave out Col5 because I don't want it shown in the grid:

this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] {"Col1", "Col2", "Col3", "Col4" });


Then, I try to put Col5 back visible again:
this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] {"Col1", "Col2", "Col3", "Col4", "Col5"});

But Col5 shows up in the grid without headertext and the rows are all blank? How do I rebind Col5 back to the databoundgrid? Thanks!


1 Reply

JS Jeba S Syncfusion Team July 2, 2007 05:38 AM UTC

Hi coder12345,

You can rebind Col5 back to the databoundgrid using this code snippets:

this.gridDataBoundGrid1.DataSource = null;
this.gridDataBoundGrid1.Binder.ResetHierarchyLevels();
this.gridDataBoundGrid1.DataSource = dt;
this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] { "Col1", "Col2", "Col3", "Col4", "Col5"});


Kindly let us know if this helps.

Best Regards,
Jeba.

Loader.
Live Chat Icon For mobile
Up arrow icon