Getting at the "old" value in CellEndEdit

2 posts, 0 answers
  1. Dave
    Dave avatar
    21 posts
    Member since:
    Jan 2005

    Posted 16 Dec 2017 Link to this post

    When a user edits a cell and I need to update a row, I need to know the old value that was there before (I cannot get it without requerying the entire data set).

    Right now as a hack I'm saving it in CellBeginEdit, but I'm hoping there's a better solution:


            string oldValue;
            private void deviceGrid_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
                if (e.Column.Name == "DeviceName")
                    oldValue = e.Row.Cells["DeviceName"].Value.ToString();

            private void deviceGrid_CellEndEdit(object sender, GridViewCellEventArgs e)
                if (e.Column.Name == "DeviceName")
                    string newName = e.Value.ToString();

                    Device device = Program.SapphireService.GetDeviceXmlByID(oldValue);
                    Program.SapphireService.UpdateDevice(device, newName);

  2. Dimitar
    Dimitar avatar
    2951 posts

    Posted 18 Dec 2017 Link to this post

    Hello Dave,

    You can use the RowsChanging event where both values are available:
    private void RadGridView1_RowsChanging(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e)
        if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanging)

    I hope this will be useful. Let me know if you have additional questions.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top