I have a radGrid with a Master-Child-Relation and Edit mode is set to Batch.
The data will be populated via OnNeedDataSource for the master and via OnDetailTableDataBind.
The master table columns are readonly; the child columns not.
I would like to process data changes in the OnBatchEditCommand but the detail changes were not submitted.
(The e.Commands-collection has no members).
Any ideas ?
Thanks in advance.
The example show a simple Role/UsersInRole relationship.
<telerik:RadGrid ID="RadGrid2" runat="server"
AutoGenerateColumns="False"
CellSpacing="0"
CellPadding="0"
GridLines="None"
MasterTableView-EditMode="Batch"
Width="350px"
AllowMultiRowEdit="true"
OnNeedDataSource="RadGrid2_NeedDataSource"
OnBatchEditCommand="RadGrid2_BatchEditCommand"
OnDetailTableDataBind="RadGrid2_DetailTableDataBind">
<MasterTableView
DataKeyNames="Rolename"
EditMode="Batch"
CommandItemDisplay="Top"
HierarchyDefaultExpanded="true"
ExpandCollapseColumn-Visible="true"
GroupsDefaultExpanded="true">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="true" >
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<CommandItemSettings ShowSaveChangesButton="true" ShowCancelChangesButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
<Columns>
<telerik:GridBoundColumn UniqueName="Rolename" DataField="Rolename" HeaderText="Role"></telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView runat="server"
Name="Detail"
AutoGenerateColumns="false"
DataKeyNames="Username"
Width="100%"
EditMode="Batch"
ShowHeader="false"
ShowFooter="false"
AllowPaging="false"
AllowFilteringByColumn="false"
GridLines="None"
BorderStyle="None"
BatchEditingSettings-EditType="Cell">
<ParentTableRelation>
<telerik:GridRelationFields
DetailKeyField="Rolename"
MasterKeyField="Rolename" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn UniqueName="Rolename" DataField="Rolename" HeaderText="Role" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Username" DataField="Username" HeaderText="User"></telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
protected void RadGrid2_BatchEditCommand(object sender, GridBatchEditingEventArgs e){ // e.Commands has no items for changes made in detail view foreach (GridBatchEditingCommand command in e.Commands) { Hashtable newValues = command.NewValues; Hashtable oldValues = command.OldValues; string OldRolename = oldValues["Rolename"].ToString(); string NewRolename = newValues["Rolename"].ToString(); // processing values }}protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){ if (!e.IsFromDetailTable) { RadGrid2.DataSource = GetRoles(); }}protected void RadGrid2_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e){ var parentItem = e.DetailTableView.ParentItem as GridDataItem; if (e.DetailTableView.Name == "Detail") { string Rolename = parentItem.GetDataKeyValue("Rolename").ToString(); e.DetailTableView.DataSource = GetUsersInRole(Rolename); }}