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

Keep Expanded NestedViewTemplate on Rebind of Parent RadGrid

1 Answer 134 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 09 Sep 2011, 01:21 AM
I have a RadGrid with a NestedViewTemplate that has another RadGrid in a RadPageView, when I update the RadGrid in the RadPageView I need to rebind the Parent Grid and keep the Parent RadGrid item expanded and RadPageView displayed.

Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Sep 2011, 03:11 PM
Hello Scott,
Try the following approach to achieve your scenario.
C#:
int flag = 0,index;
   protected void RadGrid2_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
   {
       RadGrid grid = (RadGrid)sender;
       GridNestedViewItem item = (GridNestedViewItem)grid.NamingContainer;
       GridDataItem parentItem = (GridDataItem)item.ParentItem;
       flag = 1;
       index = parentItem.ItemIndex;
   }
   protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       if (flag == 1)
       {
           GridDataItem item = (GridDataItem)RadGrid1.Items[index];
           item.Expanded = true;
           flag = 0;
       }
   }

Thanks,
Shinu.
Tags
Grid
Asked by
Scott Marx
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or