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

Hide Columns - Several Detail Tables at a single hierarchy level

3 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aret
Top achievements
Rank 1
Aret asked on 27 May 2014, 01:44 PM
Greetings,

I have a radgrid where its datasource is bound from an XML output.  It has multiple hierarchy levels and has (auto genearted columns = true).  On the  2nd level of the hierarchy there are several details tables that automatically get binded. (Please reference image below).  However, there are columns which get auto generated displaying the ID's for the detail tables.  My goal is to programmatically hide all the ID's in all detail tables.   I can hide the CusomterID programmatically using the following code below: 

For Each item As GridDataItem In Radgrid_CRGList.Items        
               
       ''Root Level of Radgrid
         Radgrid_CRGList.MasterTableView.GetColumnSafe("OrderID").Visible = False        

     ''2nd Level of Radgrid - 1st Detail Table
      Radgrid_CRGList.MasterTableView.DetailTables(0).GetColumnSafe("CustomerID").Visible = False        
   
    ''2nd Level of RadGrid - 2nd Detail Table                                
'''  Place code here to hide EmployeeID ''

Next 


The issue is that I can't figure out the code to hide the EmployeeID in the 2nd details table on the same hierarchy level of the radgrid.  Please Help!









3 Answers, 1 is accepted

Sort by
0
Aret
Top achievements
Rank 1
answered on 27 May 2014, 01:48 PM
here is the picture of my radgrid relating to my post.
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 May 2014, 04:18 AM
Hi Aret,

Please try the following code snippet to hide the columns in detail table.

VB:
Protected Sub RadGrid1_PreRender(sender As Object, e As EventArgs)
    RadGrid1.MasterTableView.GetColumn("OrderID").Visible = False
    'Access first detailtable in 2nd level
    RadGrid1.MasterTableView.DetailTables(0).GetColumn("CustomerID").Visible = False
    'Access second detailtable in 2nd level
    RadGrid1.MasterTableView.DetailTables(1).GetColumn("EmployeeID").Visible = False
    RadGrid1.Rebind()
End Sub

Thanks,
Princy
0
Aret
Top achievements
Rank 1
answered on 30 May 2014, 12:41 PM
Thank You! Thank Worked
Tags
Grid
Asked by
Aret
Top achievements
Rank 1
Answers by
Aret
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or