This is a migrated thread and some comments may be shown as answers.

PreRender for Hierarchy Grids? Removal of Hierarchy/Detail Columns

1 Answer 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Corey
Top achievements
Rank 1
Corey asked on 29 Nov 2012, 07:38 PM
I have a radgrid which each row has a detail grid.
I am making the grid programmatically.

I have these set :
RadGrid1.AutoGenerateHierarchy = True
RadGrid1.MasterTableView.AutoGenerateColumns = True

With the above setting I can remove columns from master table using, 
Protected Sub RadGrid1_PreRender(sender As Object, e As EventArgs)
    RadGrid1.MasterTableView.GetColumn("ID").Visible = False
End Sub

However, I cannot find a way to do this (or something similar) for the Hierarchy created tables.

Any Suggestions?

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 30 Nov 2012, 04:37 AM
Hello,

Private Sub HideIDColumnRecursive(tableView As GridTableView)
    Dim nestedViewItems As GridItem() = tableView.GetItems(GridItemType.NestedView)
    For Each nestedViewItem As GridNestedViewItem In nestedViewItems
        For Each nestedView As GridTableView In nestedViewItem.NestedTableViews
            nestedView.GetColumn("ID").Visible = False
            If nestedView.HasDetailTables Then
                HideIDColumnRecursive(nestedView)
            End If
        Next
    Next
End Sub
 
 
 
Protected Sub RadGrid1_PreRender(sender As Object, e As EventArgs)
    RadGrid1.MasterTableView.GetColumn("ID").Visible = False
    HideIDColumnRecursive(RadGrid1.MasterTableView)
End Sub


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Corey
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or