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

Nested Grid

1 Answer 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
nagendra
Top achievements
Rank 1
nagendra asked on 16 Oct 2010, 12:13 PM
Hi ,
I have Nested Grid.. I need to add new row to detail Table on click of button in Parent Grid.. I need to make Detail table visible and new row to be added when parent table button is clicked. Please provide me a solution to this.

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 21 Oct 2010, 04:23 PM
Hi nagendra,

You can do this in the ItemCommand event in the following way:
 
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName=="MyCommandName")
        {
            e.Item.Expanded = true;
            GridTableView gridNestedView = (e.Item as GridDataItem).ChildItem.NestedTableViews[0];
            gridNestedView.IsItemInserted = true;
            gridNestedView.Rebind();
        }
    }
in the markup for the master grid you need to make a button column with the specified CommandName that will trigger this operation:
<MasterTableView ...>
      <Columns>
           //...
             <telerik:GridButtonColumn UniqueName="btnCol" ButtonType="PushButton" CommandName="MyCommandName" Text="MyCommand"></telerik:GridButtonColumn>
      </Columns>
</MasterTableView>

Let me know how this works for you and if you have any other questions.

Greetings,
Marin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
nagendra
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or