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

Insert/Update/Delete Master Detail Levels

2 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 28 May 2009, 09:51 AM
Hi,

How can I know if the following operations comes from a master record or a detail one?

Because the same event onDeleteCommend,OnUpdateCommend,... is used for both, 

Thanks.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 May 2009, 10:02 AM
Hello Joseph,

You can use the Name properties of the various GridTableViews to distinguish between the MasterTableView and the DetailTable:
aspx:
 <telerik:RadGrid  ID="RadGrid1" runat="server" OnUpdateCommand="RadGrid2_UpdateCommand" OnInsertCommand="RadGrid2_InsertCommand" OnDeleteCommand="RadGrid2_DeleteCommand">       
     <MasterTableView DataSourceID="SqlDataSource1" Name="Master">       
       <DetailTables>        
        <telerik:GridTableView DataSourceID="SqlDataSource1" Name="Detail" runat="server" > 
         .... 

c#:
 protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.Item.OwnerTableView.Name == "Detail"
       { 
          //update code here 
       } 
    } 
Similarly you can try for other commands as well.

Thanks
Princy.


0
Joseph
Top achievements
Rank 1
answered on 28 May 2009, 10:05 AM
Thanks princy. this will do the job.
Tags
Grid
Asked by
Joseph
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Joseph
Top achievements
Rank 1
Share this question
or