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

Expand Child Gridview on Parent Edit Command

2 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott Marx
Top achievements
Rank 1
Scott Marx asked on 22 Dec 2010, 12:22 AM
I have a nested gridview and would like to expand the child gridview when the edit command is fired on the parent record.

Any suggestions or solutions would be appreciated.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Dec 2010, 05:26 AM
Hello Scott,

The following code snippet shows how to achieve this.

C#:
Int32 itemIndex = -1;
   protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.EditCommandName)
       {
          itemIndex = e.Item.ItemIndex;
       }
   }
   protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       if (itemIndex > -1)
       {
           RadGrid1.MasterTableView.Items[itemIndex].Expanded = true;
           itemIndex = -1;
       }
   }

Thanks,
Princy.
0
Scott Marx
Top achievements
Rank 1
answered on 22 Dec 2010, 07:26 PM
I was so close... Thanks for the help.
Tags
Grid
Asked by
Scott Marx
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Scott Marx
Top achievements
Rank 1
Share this question
or