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

how to log "oldvalue" and "newvalue" when grid inserted/deleted/updated

2 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrey
Top achievements
Rank 1
Andrey asked on 01 Nov 2010, 05:40 PM
    Hello.
I used RadGrid with declarative binding to SqlDataSource.
I need to store old and new values in log table when I make insert/delete/update operation.
I can handle RadGrid_UpdateCommand event like this:

protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editItem = (GridEditableItem)e.Item;
          
    //extract the edited values in a Hashtable
    Hashtable values = new Hashtable();
    editItem.ExtractValues(values);
  
    //get the saved old values before editing
    Hashtable oldValues = (Hashtable)editItem.SavedOldValues;
      
    //insert  data to Database
    //...    
}

but this event fires before real operation in database and I don`t know if there is an error in current operation in DB or not.
Can anybody help?

2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 01 Nov 2010, 05:52 PM
Hello Andrey,

Please find attached to this message a simple working project that demonstrates how you can achieve the desired functionality. Give it a try and let me know if it helps.

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andrey
Top achievements
Rank 1
answered on 02 Nov 2010, 09:28 AM
  Thanks, Pavlina. It`s really help me!
Tags
Grid
Asked by
Andrey
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Andrey
Top achievements
Rank 1
Share this question
or