Heirarchical RadGrid Columns Issue

2 posts, 0 answers
  1. Sathvika
    Sathvika avatar
    1 posts
    Member since:
    Sep 2014

    Posted 11 Jan 2017 Link to this post

    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'

  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 16 Jan 2017 Link to this post

    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

    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.
Back to Top