I have an ObjectDataSource bound to my Grid, and the Automatic Updating works fine for all controls except for the RadComboBox in one of my columns as I'm not sure how to bind to it. In my ObjectDataSource, the values that are selected from the RadComboBox are stored in a List. In a regular ListView, I would just grab the selected values and put them in a List and assign them to e.NewValues() in the ListView's ItemUpdating event. I can't seem to figure out how to do something similar in the Grid's UpdateCommand event. Below is some abbreviated code to show what I'm trying to do. Appreciate any help you can offer.
Public
Class
MyCase
Public
Sub
New
()
End
Sub
Private
intId
As
Nullable(Of
Integer
)
Public
Property
Id()
As
Nullable(Of
Integer
)
Get
Return
intId
End
Get
Set
(
ByVal
value
As
Nullable(Of
Integer
))
intId = value
End
Set
End
Property
Private
strCaseName
As
String
Public
Property
CaseName()
As
String
Get
Return
strCaseName
End
Get
Set
(
ByVal
value
As
String
)
strCaseName = value
End
Set
End
Property
Private
objCodes
As
List(Of MyCode) =
New
List(Of MyCode)
Public
Property
CodeList()
As
List(Of MyCode)
Get
Return
objCodes
End
Get
Set
(
ByVal
value
As
List(Of MyCode))
objCodes = value
End
Set
End
Property
End
Class
Public
Class
MyCode
Public
Sub
New
()
End
Sub
Private
intId
As
Nullable(Of
Integer
)
Public
Property
Id()
As
Nullable(Of
Integer
)
Get
Return
intId
End
Get
Set
(
ByVal
value
As
Nullable(Of
Integer
))
intId = value
End
Set
End
Property
Private
strName
As
String
Public
Property
Name()
As
String
Get
Return
strName
End
Get
Set
(
ByVal
value
As
String
)
strName = value
End
Set
End
Property
End
Class
Protected
Sub
gridCases_UpdateCommand(sender
As
Object
, e
As
GridCommandEventArgs)
End
Sub
<
telerik:RadGrid
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"gridCases"
AutoGenerateColumns
=
"false"
AllowPaging
=
"true"
DataSourceID
=
"odsCases"
AllowSorting
=
"true"
OnUpdateCommand
=
"gridCases_UpdateCommand"
AllowAutomaticUpdates
=
"true"
>
<
MasterTableView
DataSourceID
=
"odsCases"
DataKeyNames
=
"Id"
CommandItemDisplay
=
"Top"
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
EditMode
=
"InPlace"
CommandItemSettings-ShowRefreshButton
=
"false"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Id"
ReadOnly
=
"true"
ForceExtractValue
=
"Always"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
DataField
=
"CaseName"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Codes"
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "Codes").ToString%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
RenderMode
=
"Lightweight"
ID
=
"ddlCodes"
runat
=
"server"
CheckBoxes
=
"true"
DataSourceID
=
"odsCodes"
DataTextField
=
"Name"
DataValueField
=
"Id"
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridEditCommandColumn
></
telerik:GridEditCommandColumn
>
</
Columns
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
</
telerik:RadGrid
>
<
asp:ObjectDataSource
ID
=
"odsCases"
runat
=
"server"
TypeName
=
"MyCaseManager"
DataObjectTypeName
=
"MyCase"
SelectMethod
=
"GetList"
UpdateMethod
=
"Save"
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"odsCodes"
runat
=
"server"
DataObjectTypeName
=
"MyCode"
SelectMethod
=
"GetCachedList"
TypeName
=
"MyCodeManager"
>
</
asp:ObjectDataSource
>