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

How to get the old values

4 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ShahabG
Top achievements
Rank 1
ShahabG asked on 16 Aug 2011, 03:32 PM
Hi
I put the grid in edit mode and getting the new values , But I want to get the old values for comparison. How do I use SavesOldValues

       If (e.CommandName = "UpdateAll") Then
            For Each editedItem As GridEditableItem In grdItemCatgLoc.EditItems

                Dim newValues As Hashtable = New Hashtable
                e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
                Dim ProductID As Long = newValues("ProductID")
'getting the old values ?????????????????????????
Dim grdDataitem As GridDataItem = e.Item.DataItem
Dim OldProductID as Long =  grdDataitem.SavedOldValues("ProductID")



editeditem.Edit=False
Next

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Aug 2011, 08:02 PM
Hello,

<MasterTableView DataKeyNames="ProductID">
if(e.CommandName = "UpdateAll")
            {
                foreach (GridEditableItem item in RadGrid1.EditItems)
                {
                    string oldProductId = item.GetDataKeyValue("ProductID").ToString(); // Get your Old Value
                    // your logic here
                }
            }


Thanks,
Jayesh Goyani
0
ShahabG
Top achievements
Rank 1
answered on 16 Aug 2011, 08:05 PM
Hi
This is good for the key value, how about a field like ProductName which is not the GetDataKeyValue?
Thanks
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Aug 2011, 08:09 PM
Hello,

You can take multiple DataKeyNames also.
 
<MasterTableView DataKeyNames="ProductID,ProductName">


Thanks,
Jayesh Goyani
0
ShahabG
Top achievements
Rank 1
answered on 17 Aug 2011, 11:42 AM
Thanks, it worked
Tags
Grid
Asked by
ShahabG
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
ShahabG
Top achievements
Rank 1
Share this question
or