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

GDBG: After a layout change, column value and header won''t display

In a DataboundGrid, I''m using Binder.LayoutColumns to show and hide the Note field based on a user option. Something like: If mnuShowNote.checked = True Then ''Show Note dbg.Binder.LayoutColumnes ( New String() _ {"ColA", "ColB", "etc.", ".", _ "Note") Else ''Hide Note dbg.Binder.LayoutColumnes ( New String() _ {"ColA", "ColB", "etc.",) End If The first time the grid is populated and displayed it is shown with the note. However, after displaying it without the Note once then changing the layout back to display the note, the spaces in the layout are there but the value for the Note and the Note''s Header text are blank. What hasn''t worked: 1) Refresh(), 2) ResetCurrentCellInfo(), 3) Setting the DataSource to Nothing, changing the layout and then setting the datasource. What am I missing? Thank you to the Syncfusion Team Kenton

6 Replies

AD Administrator Syncfusion Team September 1, 2004 02:52 PM UTC

Try calling grid.Binder.InitializeColumns after changing the columns to see if that will set things up properly.

KH Kenton Hensley September 1, 2004 03:23 PM UTC

Tried this as you suggested but it had no effect.

AD Administrator Syncfusion Team September 1, 2004 05:23 PM UTC

To get this to work, you have to reset the GridBoundColumns. Here is a sample showing how you might do this. GDBGSample_7594.zip

KH Kenton Hensley September 7, 2004 04:44 PM UTC

Thank you! Worked as you have shown in your sample. Much appreciated. I have one question: I experimented with cloning the internal columns collection [Dim gbc as GridBoundColumnsCollection = grdGBDG.Binder.InternalColumns.Clone()] and assigning it to a local, procedure-level variable right before assigning the layout string, instead of using a file-level variable, and it exhibited the same undesireable behavior posed in this thread. Why does the InternalColumns collection need to be saved during form Load? Thank you again, Clay. Kenton

AD Administrator Syncfusion Team September 7, 2004 04:51 PM UTC

Calling LayoutColumns actually steps on the internal columns collections, so you need to get the clone before doing the LayoutColumns call.

KH Kenton Hensley September 8, 2004 10:55 AM UTC

Thank you.

Live Chat Icon For mobile
Up arrow icon