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

How to refresh/rebind all detail tables (grids) on update operation of Radgrid

1 Answer 888 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zain
Top achievements
Rank 1
Zain asked on 24 Dec 2015, 03:57 AM

Hi

I want to refresh/rebind all child grids (child2 gridtableview) on edit/insert case of chid1 (gridtableview), child1 and chid2 are on same level in Detail tables of RadGrid.

I am using update command function to insert/edit records in chid1.

After completing insert/edit case of child1 gridview rebind automatically while the other child2 on same level contain old data, i want to refresh/rebind the child2 grid as well.

Here is code structure for understanding... 

 

<telerik:RadGrid ID="PlEmployee" runat="server" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True"

OnUpdateCommand="PlEmployee_UpdateCommand"

<DetailTables> 

    <telerik:GridTableView runat="server" Name="Child1">

     <telerik:GridTableView runat="server" Name="Child2">  

 </DetailTables>

 </telerik:RadGrid>

 

Regards,

Zain

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 24 Dec 2015, 09:39 AM
Hi Zain,

Use the Parent of the current item TableView to get the GridDataRow of the PlEmployee. Then .ChildItem.NestedTableViews to get all TableViews for the given item. Then rebind each of them.

GridTableView Child1View = e.Item.OwnerTableView; //get the Child1 from the currnet item
GridDataItem PlEmployeeDataItem = Child1View.ParentItem; //Get the DataItem of PlEmployee
 
GridNestedViewItem NestedViewItem = PlEmployeeDataItem.ChildItem; //Get nested view item
GridTableView[] children = NestedViewItem.NestedTableViews; // gets Child1, and Child2 for the current item.
 
for (int i = 0; i < children.Length; i++)
{
    children[i].Rebind();
}


Regards,
Vasil
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Zain
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or