I'm almost there on this solution. I have a RadGrid that I received assistance with to create RadioButtons in the columns so that only one row value can be selected at a time per column. This works perfectly and now I'm trying to submit the results using an external button so that the values can be saved in the database. All of the rows are put into edit mode when the page loads. The problem is that the update command is only firing for the first row using my code...
Here is the code for the external button
If I change this line...
so that "i" is the row index I want to submit, I can get the values to submit for that particular row.
I'm not sure why the for loop stops after the first run through though. Using this code, shouldn't it fire off the Update command for each row that it finds? I checked the value of items.Length and got 8 (which is correct...there are 8 rows), so it should run this 8 times and fire off the Update command for row indexes 0-7.
Let me know if I'm not understanding how this works properly...thanks =)
Here is the code for the external button
protected
void
btn_submit_Click(
object
sender, EventArgs e)
{
GridItem[] items = RadGrid1.MasterTableView.GetItems(GridItemType.EditItem);
for
(
int
i = 0; i < items.Length; i++)
{
int
itemIndex = items[i].ItemIndex;
if
(RadGrid1.EditItems[i].ItemIndex == itemIndex)
{
(items[i]
as
GridEditableItem).FireCommandEvent(
"Update"
, String.Empty);
}
}
RadGrid1.EditIndexes.Clear();
for
(
int
i = 0; i < RadGrid1.PageSize; i++)
RadGrid1.EditIndexes.Add(i);
RadGrid1.Rebind();
}
If I change this line...
if
(RadGrid1.EditItems[i].ItemIndex == itemIndex)
so that "i" is the row index I want to submit, I can get the values to submit for that particular row.
I'm not sure why the for loop stops after the first run through though. Using this code, shouldn't it fire off the Update command for each row that it finds? I checked the value of items.Length and got 8 (which is correct...there are 8 rows), so it should run this 8 times and fire off the Update command for row indexes 0-7.
Let me know if I'm not understanding how this works properly...thanks =)