I have a RadGrid that I'm supplying a data source in code-behind, and trying to use InPlace editing. I'm able to put the row in to the Edit view, enter new values, and click update, but the users new information is never saved:
the binding is done in Page.Load
I'm trying to build a Hashtabe containing what the user has changed. Here is the grid's update command:
However, oldValues and newValues are always exactly the same -- ie, what the user puts in isn't being saved.
<
telerik:RadGrid
ID
=
"radGrdDetails"
runat
=
"server"
EnableLinqExpressions
=
"false"
AllowPaging
=
"False"
AllowSorting
=
"True"
GridLines
=
"None"
Skin="<%$ AppSettings: YALSkin%>"
AllowAutomaticInserts="False" AllowAutomaticUpdates="false" AllowMultiRowEdit="false" showstatusbar="true" Width="800" AllowFilteringByColumn="true" AutoGenerateColumns="false" AutoGenerateEditColumn="false">
<
MasterTableView
CommandItemDisplay
=
"Top"
DataKeyNames
=
"ID"
EditMode
=
"InPlace"
>
<
Columns
>
<
telerik:GridEditCommandColumn
/>
<
telerik:GridBoundColumn
UniqueName
=
"ID"
ReadOnly
=
"true"
Visible
=
"false"
DataField
=
"ID"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"NUMBER"
ReadOnly
=
"true"
DataField
=
"NUMBER"
HeaderText
=
"Number"
SortExpression
=
"NUMBER"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"TYPE"
ReadOnly
=
"true"
DataField
=
"TYPE"
HeaderText
=
"Type"
SortExpression
=
"TYPE"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"COUNTY"
DataField
=
"COUNTY"
HeaderText
=
"County"
SortExpression
=
"COUNTY"
></
telerik:GridBoundColumn
>
</
Columns
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
</
MasterTableView
>
</
telerik:RadGrid
>
the binding is done in Page.Load
I'm trying to build a Hashtabe containing what the user has changed. Here is the grid's update command:
Protected
Sub
radGrdDetails_UpdateCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
radGrdDetails.UpdateCommand
Dim
oldValues, newValues, changedValues
As
Hashtable
newValues =
New
Hashtable
changedValues =
New
Hashtable
Dim
editedItem
As
GridEditableItem =
CType
(e.Item, GridEditableItem)
oldValues = editedItem.SavedOldValues
editedItem.ExtractValues(newValues)
For
Each
key
As
String
In
oldValues.Keys
If
oldValues(key) = newValues(key)
Then
'field has not changed, don't edit
Else
'field has changed
changedValues.Add(key, newValues(key))
End
If
Next
End
Sub
However, oldValues and newValues are always exactly the same -- ie, what the user puts in isn't being saved.