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

How can I update mastertableview columns after update in row of detailtableview ?

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ankool
Top achievements
Rank 1
ankool asked on 19 Apr 2010, 12:50 PM
Hi,

I am using single XML file to update both MasterTable and DetailTable views.

When I edit a row in detailTable, then XML is updated and so is values of few columns in mastertableview.
The update in detailTable view take place via edit template and by default after UpdateCommand completion, which updates required XML. The control goes to NeedDatasource and DetailTableDataBind. sample code below

protected

 

void RadGridFinancials_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

    RadGrid1.DataSource = ds.Tables[

"NEWXML"];
    // OR should I use
    //RadGrid1.MasterTableView.DataSource = ds.Tables["NEWXML"]; But this also does not update mastertableview
    // HierarchyLoadMode = "ServerOnDemand"

 

}

 

protected void RadGridFinancials_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)

 

{

 

    e.DetailTableView.DataSource =  ds.Tables["NEWXML"];

 

 

}
But after these calls only detailtableview gets updated and not mastertableview.
So How can I update mastertableview columns after update in row of detailtableview ?
This is required because few columns in mastertable view is valued as sum of a particular column in detailtableview. So an update in row of childtable needs to update parent tableview row.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 21 Apr 2010, 03:31 PM
Hello ankool,

In order the MasterTableView items to show the updated data, you need to Rebind() the grid. You can try using the below code for that purpose:

protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)  
{  
   //code for database update  
   e.Canceled = true;  
   e.Item.Edit = false
   (sender as RadGrid).Rebind();  
}


Best wishes,
Iana
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
ankool
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or