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

Updating MasterTableView from DetailsTable

1 Answer 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chase
Top achievements
Rank 1
chase asked on 25 Aug 2008, 10:13 PM
Hi All,

I have a two level hiearchary RadGrid and in the MastertableView there is a column which is a sum of a column in the DetailsTable. When I update a row in the DetailsTable how can I force the parent MasterTableView row to update as well to reflect the new sum?

Thanks

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 27 Aug 2008, 11:07 AM
Hello chase,

Here is what you need to add. In the UpdateCommand event handler, you can get a reference to the updated item's parent item and update a control in it. The following example assumes we have created a template column in the MasterTableView with a label control inside that can be updated when child items are edited:

void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    if(e.Item.OwnerTableView != RadGrid1.MasterTableView) 
        (e.Item.OwnerTableView.ParentItem["TemplateColumn"].FindControl("Label1"as Label).Text = "Changed"

The above code checks if the currently updated item belongs to a detail table, and if true, gets the item's parent item and updates a control inside its template column.

Greetings,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
chase
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or