list of changed rows

2 posts, 0 answers
  1. NVB
    NVB avatar
    39 posts
    Member since:
    Apr 2009

    Posted 10 Jan 2013 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jan 2013 Link to this post

    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.
Back to Top