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

How to hide edit column at parent level

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 26 Jun 2013, 01:46 AM
my radgrid had 2 level (parent & sublevel)
how can i hide the edit column in parent level (remain collapse column) ?

thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 26 Jun 2013, 07:12 AM
Hi Joe,

I'm not sure about your requirement,hope you want to hide the parent edit when expanded.Please try the following code snippet.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" onprerender="RadGrid1_PreRender">
    <MasterTableView  HierarchyDefaultExpanded="false">
        <DetailTables>
            <telerik:GridTableView . . . . . . .>
                <ParentTableRelation>
                    <telerik:GridRelationFields . . . . . />
                </ParentTableRelation>
                <Columns>                         
                    . . . . . . . . . . . . . .
                  <telerik:GridEditCommandColumn UniqueName="EditChild">
                  </telerik:GridEditCommandColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>                   
           . . . . . . . . . . . . .           
              <telerik:GridEditCommandColumn UniqueName="EditParent" >
              </telerik:GridEditCommandColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
 foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
  {
    if (item.Expanded)
     {
      foreach (GridColumn column in RadGrid1.MasterTableView.Columns)
      {
        if (column.UniqueName == "EditParent")
        {
          column.Visible = false;
        }
      }
     }
   }
}

Hope this helps.

Thanks,
Princy
Tags
Grid
Asked by
Joe
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or