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

Hiding Column in DetailTableView

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kaveh
Top achievements
Rank 1
Kaveh asked on 26 Jan 2012, 07:37 PM
Hello -

I would like to hide the "Edit" column in the DetailTableView for those records which do not have a child record.  However, I would still like the "Add New Record" button to show in the DetailTable.  I would like to check the DataValueKey, and then hide the column if it is null.
I have tried a number of things and none of them seem to work.  

Thanks for your ongoing help.

K

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 27 Jan 2012, 02:39 PM
Hello Kaveh,

<MasterTableView DataKeyNames="ID" Name="Parent" HierarchyLoadMode="Client">
               <Columns>
                   <telerik:GridBoundColumn DataField="ID" UniqueName="ID">
                   </telerik:GridBoundColumn>
                   
                   <telerik:GridEditCommandColumn UniqueName="MyEditColumn">
                   </telerik:GridEditCommandColumn>
               </Columns>
               <DetailTables>
                   <telerik:GridTableView Name="Child">
                       <Columns>
                           <telerik:GridBoundColumn DataField="ID" UniqueName="ID">
                           </telerik:GridBoundColumn>
                           
                       </Columns>
                   </telerik:GridTableView>
               </DetailTables>
           </MasterTableView>
protected void RadGrid1_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
   {
       GridDataItem item = e.DetailTableView.ParentItem as GridDataItem;
 
       // do your logic here or get Row Count here
 
       item["MyEditColumn"].Controls[0].Visible = false;
 
   }


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