I am having trouble extracting the data of a multi-row edit using the techniques described in the "Performing batch updates" article when the data is in a Detail Table, not in the main table.
To set the scene, I have two command buttons, one to Edit All Rows which loops through evey editable item of the DataTable and sets Edit=true. The other button then issues a SaveAll command to save the new data in each item.
All of my columns are GridTemplateColumns and have labels in their ItemTemplate to display the data and textbox or or other controls in their EditItemTemplate to allow for editing of the data. I am able to pull the data when the Update button is hit on the row but when I have an Update All command button, it does not work. I have the following IF statement in my ItemCommand:
The trouble is the FindControl always returns null even though I just entered data into the text box. The Item Template of the GridTemplateColumn puts the data into a label called lblPrice. This label is fully accessable via FindControl. It doesn't seem to recognize that it is in Edit Mode even though Edit = true (although IsEditMode = false, is this supposed to be the case?).
If I try the same exact code on the main table, it works great.
Any thoughts as to what I am missing?
Thank you,
Oleg Fridman
To set the scene, I have two command buttons, one to Edit All Rows which loops through evey editable item of the DataTable and sets Edit=true. The other button then issues a SaveAll command to save the new data in each item.
All of my columns are GridTemplateColumns and have labels in their ItemTemplate to display the data and textbox or or other controls in their EditItemTemplate to allow for editing of the data. I am able to pull the data when the Update button is hit on the row but when I have an Update All command button, it does not work. I have the following IF statement in my ItemCommand:
if (e.CommandName == "SaveAll") |
{ |
//foreach (GridItem item in e.Item.OwnerTableView.Items) |
foreach (Telerik.Web.UI.GridEditableItem item in rgOptions.EditItems) |
{ |
string price = ((TextBox)e.Item.FindControl("txtPrice")).Text; |
// Perform some kind of save to DB here |
item.Edit = false; |
} |
e.Item.OwnerTableView.Rebind(); |
} |
The trouble is the FindControl always returns null even though I just entered data into the text box. The Item Template of the GridTemplateColumn puts the data into a label called lblPrice. This label is fully accessable via FindControl. It doesn't seem to recognize that it is in Edit Mode even though Edit = true (although IsEditMode = false, is this supposed to be the case?).
If I try the same exact code on the main table, it works great.
Any thoughts as to what I am missing?
Thank you,
Oleg Fridman