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

Heirarchical RadGrid Columns Issue

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sathvika
Top achievements
Rank 1
Sathvika asked on 11 Jan 2017, 03:19 PM

I have a Heirarchical RadGrid on my page where MasterTable columns are different from DetailTable.

MasterTable Columns:

 <telerik:GridEditCommandColumn EditImageUrl="~/Content/Telerik/Grid/Edit.gif" ButtonType="ImageButton" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
 <telerik:GridBoundColumn UniqueName="PEER_SK" HeaderText="Peer ID" DataField="PEER_SK"></telerik:GridBoundColumn>
 <telerik:GridBoundColumn UniqueName="PEER_NAME" HeaderText="Peer Type Name" DataField="PEER_NAME"></telerik:GridBoundColumn>

 

Detail Table Columns:

 <telerik:GridBoundColumn UniqueName="PEER_SK" HeaderText="Peer ID" DataField="PEER_SK" Visible="false" ReadOnly="true"></telerik:GridBoundColumn>
 <telerik:GridBoundColumn UniqueName="GRP_ID" HeaderText="Grp ID" DataField="GRP_ID" Visible="false" ReadOnly="true"></telerik:GridBoundColumn>

The grid displays fine. But When I try to expand MasterTable row, I get an error saying  Cannot find a cell bound to column name 'EditCommandColumn'

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 16 Jan 2017, 08:33 AM
Hi Sathvika,

I assume you are accessing the EditCommandColumn on the server and since the Detail table does not have such column it throws an exception. A possible solution is to set a Name to the master table view and check it on the server when you access the value of the column. Please check out the following code snippet.
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
{
    if(e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Mater")
    {
        //your logic
    }
}

Regards,
Kostadin
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Sathvika
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or