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

Grid with MasterDetail and two Editors

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Randy Bauer
Top achievements
Rank 1
Randy Bauer asked on 17 Dec 2009, 05:04 PM
Hello,

I have a grid that has a master and detail.  I've turned on the ability for the user to add a master record and a detail.  Both have the radEditor on the edit screen, allowing them to insert new records.  With the needdatasource, how do I now which insert there are selecting?  How can I tell if they are inserting a master vs a detail record?

Thanks,

Randy

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Dec 2009, 06:00 AM

Hi Randy,

You can set the Name property for the DetailTable and the MasterTable  in the aspx as shown below to differentiate  between them on insert.
aspx:

 

 <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" runat="server" OnItemDataBound="RadGrid2_ItemDataBound">              
   <MasterTableView HierarchyLoadMode="ServerOnDemand" Name="Master">        
      <DetailTables> 
        <telerik:GridTableView Name="Detail" DataSourceID="SqlDataSource1" runat="server" > 
          .... 

cs:

 protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
        {  
            if (e.CommandName == "PerformInsert" && e.Item.OwnerTableView.Name=="Detail")  
            {  
            }  
 if (e.CommandName == "PerformInsert" && e.Item.OwnerTableView.Name=="Master")  
            {  
            }  
        } 

Thanks
Princy


Tags
Grid
Asked by
Randy Bauer
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or