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

Columns Won't Unhide

Hello,

I have given our users the option of filtering what columns appear within a griddataboundgird - I store this flag in the prefix column name within a dataset - When I first setup the grid all the columns show correctly, if I remove columns they also display correctly. When I however add a column that was previously removed, even though I set the column hidden to false on the grid the column does not display visually. The grid itself gets an empty space at the end of the grid where the column should appear but I can't see anything visually. What am I doing wrong?

Sample code:

        GridDataBoundGrid1.GridBoundColumns.Clear()

        ds.Tables.Add(dt)
        GridDataBoundGrid1.AllowProportionalColumnSizing = True
        GridDataBoundGrid1.DataSource = ds.Tables(0)

        For Each col As DataColumn In ds.Tables(0).Columns
            If col.Prefix.ToLower = "hide" Then
                GridDataBoundGrid1.Model.Cols.Hidden(col.ColumnName) = True
            Else
                GridDataBoundGrid1.Model.Cols.Hidden(col.ColumnName) = False
            End If
        Next
        GridDataBoundGrid1.Refresh()


Thank You


3 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team January 21, 2016 03:42 PM UTC

Hi Ashley,

We tried to reproduce the issue with “Columns not unhide properly” from our end, but we are unable to reproduce it. We tested the reported scenario in the below sample and it is working as expected.

Sample:
http://www.syncfusion.com/downloads/support/forum/121733/ze/TestedSample914758056

Please reproduce the issue in the above sample, so that we can able provide exact solution.

Regards
Jagadeesan


AB Ashley Bates January 22, 2016 09:25 AM UTC

Hello,

I did some more digging into this and have found that if I add in -

        GridDataBoundGrid1.AllowProportionalColumnSizing = True

then when I unhide the column it doesn't work - If I add this line into the sample you have provided as follows -

Private Sub change()
            For Each column As DataColumn In dataSet.Tables(0).Columns
                If column.Prefix.ToLower() = "hide" Then
                    Me.gridDataBoundGrid1.Model.Cols.Hidden(column.ColumnName) = True
                Else
                    Me.gridDataBoundGrid1.Model.Cols.Hidden(column.ColumnName) = False
                End If
            Next column
            gridDataBoundGrid1.AllowProportionalColumnSizing = True

            Me.gridDataBoundGrid1.Refresh()
        End Sub

Then when you unhide the column it will not appear.

Thank You.


JP Jagadeesan Pichaimuthu Syncfusion Team January 25, 2016 11:50 AM UTC

Hi Ashley,

Thank you for contacting Syncfusion support.

We have created an incident  on behalf of you. Our support engineer will assist you through incident. We request you to follow with the incident for further details.
 
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents 

Regards,
Jagadeesan


Loader.
Live Chat Icon For mobile
Up arrow icon