I am trying to get the selected value of a DropDownList which is created in GridTemplateColumn.
I set the selectedvalue on itemDataBound,
This does get fired when a change is made in the DropDownList, however it is alos the previous value (i check prior to setting it again). Also this does not seem like the best place for me to check this, as this is where i set the selectedValue.
Any help on this would be much appreciated.
<
telerik:GridTemplateColumn
HeaderText
=
"Style"
UniqueName
=
"STYLE"
>
<
ItemTemplate
>
<
asp:DropDownList
runat
=
"server"
ID
=
"ddl_style"
AppendDataBoundItems
=
"true"
AutoPostBack
=
"true"
>
<
asp:ListItem
Text
=
"a"
Value
=
"1"
></
asp:ListItem
>
<
asp:ListItem
Text
=
"b"
Value
=
"2"
></
asp:ListItem
>
<
asp:ListItem
Text
=
"c"
Value
=
"3"
></
asp:ListItem
>
</
asp:DropDownList
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
I set the selectedvalue on itemDataBound,
Protected
Sub
RadGrid1_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
TypeOf
e.Item
Is
GridDataItem
Then
Dim
item
As
GridDataItem =
DirectCast
(e.Item, GridDataItem)
Dim
ddl
As
DropDownList =
DirectCast
(item(
"STYLE"
).FindControl(
"ddl_style"
), DropDownList)
ddl.SelectedValue = ViewState(
"styleId"
)
ddl.DataBind()
End
If
End
Sub
This does get fired when a change is made in the DropDownList, however it is alos the previous value (i check prior to setting it again). Also this does not seem like the best place for me to check this, as this is where i set the selectedValue.
Any help on this would be much appreciated.