
Viswanathan
Top achievements
Rank 1
Viswanathan
asked on 29 Jul 2009, 08:41 AM
Hi,
In RAD hierarchical grid, how to switch the detail table rows to edit mode, on expanding a parent row which is in edit mode.
Thanks
Viswa
3 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 29 Jul 2009, 09:15 AM
Hello Viswa,
You can try out the code given in the example below to achieve your scenario:
aspx:
c#:
Thanks
Princy.
You can try out the code given in the example below to achieve your scenario:
aspx:
<telerik:RadGrid ID="RadGrid1" AllowMultiRowEdit="true" runat="server" DataSourceID="Sqldatasource1" OnPreRender="RadGrid1_PreRender" > |
<MasterTableView Name="Master" EditMode="InPlace" DataSourceID="Sqldatasource1"> |
<DetailTables> |
<telerik:GridTableView EditMode="InPlace" DataSourceID="Sqldatasource1" Name="Detail" runat="server"> |
c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
foreach (GridDataItem dataItem in RadGrid1.EditItems) |
{ |
if (dataItem.OwnerTableView.Name == "Master") |
{ |
dataItem.Expanded = !dataItem.Expanded; |
GridTableView nestedView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; |
foreach (GridDataItem item in nestedView.Items) |
{ |
item.Edit = true; |
} |
nestedView.Rebind(); |
} |
} |
} |
Thanks
Princy.
0

e
Top achievements
Rank 2
answered on 21 Aug 2009, 04:28 PM
I was having the same issue and this worked great for me! Another related question is...how do I capture the edited values when the detail table isn't using declarative data sources?
0

Shinu
Top achievements
Rank 2
answered on 24 Aug 2009, 05:12 AM
Hi,
You can access the edited values of the table in the UpdateCommand event using the name property of the GridTableView:
c#:
Thanks
Shinu.
You can access the edited values of the table in the UpdateCommand event using the name property of the GridTableView:
c#:
protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
{ |
if (e.Item.OwnerTableView.Name == "Detail") |
{ |
GridEditableItem editedItem = e.Item as GridEditableItem; |
//Get the primary key value using the DataKeyValue |
string EmployeeID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["EmployeeID"].ToString(); |
//Access the textbox from the edit form and store the values in string variables |
string LastName = (editedItem["LastName"].Controls[0] as TextBox).Text; |
string FirstName = (editedItem["FirstName"].Controls[0] as TextBox).Text; |
//Update Query to update the Datatable |
} |
} |
Thanks
Shinu.