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

2 posts, 0 answers
  1. ankool
    ankool avatar
    50 posts
    Member since:
    Apr 2007

    Posted 19 Apr 2010 Link to this post

    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.

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 21 Apr 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top