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

list of changed rows

1 Answer 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
NVB
Top achievements
Rank 1
NVB asked on 10 Jan 2013, 11:57 PM
I have radgrid  and placing complete Radgrid  in edit mode.

I have save button in command template.

I need to update the rows when  save button is clicked.

Is there a way to know the list of changed rows on server side so I can issue the update command only to that particualr row. I do not want to issue command for all the rows irrespective  whether it is changed or not.

Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Jan 2013, 05:30 AM
Hi,

As far as i know there is no straight forward way to find out the edited row only, if all the rows are in edit mode. One suggestion is to try adding an OnTextChanged event handler to the TextBox cast the sender to TextBox and add the index of the Row in a static ArrayList. Please check the sample code snippet i tried with Radgrid in Inplace edit mode and with one GridBoundColumn.

C#:
public static ArrayList IndexArray = new ArrayList();
protected void OrderID_TextChanged(object sender, EventArgs e)
{
    TextBox txtbox = (TextBox)sender;
    GridDataItem item = (GridDataItem)txtbox.NamingContainer;
    index= item.ItemIndex;
    IndexArray.Add(index);
}
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    foreach (int i in IndexArray)
    {          
         GridDataItem item = (GridDataItem)RadGrid1.MasterTableView.Items[i];
         TextBox TextBox1 = (TextBox)item["OrderID"].Controls[0];
         string value = TextBox1.Text;
          // code to update   
    }
}

Thanks,
Shinu.
Tags
General Discussions
Asked by
NVB
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or