I have a rad list box as follows:
<
telerik:RadListBox
runat
=
"server"
ID
=
"RadListBox1"
Height
=
"375px"
Width
=
"750px"
DataSourceID
=
"SqlDataSource2"
AllowReorder
=
"true"
AutoPostBackOnReorder
=
"true"
EnableDragAndDrop
=
"true"
ButtonSettings-ShowReorder
=
"true"
AllowAutomaticUpdates
=
"true"
DataKeyField
=
"SectionSort_ID"
DataTextField
=
"Header_Title"
DataValueField
=
"Header_Image"
DataSortField
=
"SectionSort_SortOrder"
SelectionMode
=
"Multiple"
>
<
ItemTemplate
>
<
telerik:RadNumericTextBox
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"ItemNo"
Width
=
"60px"
MinValue
=
"1"
MaxValue
=
"50"
ShowSpinButtons
=
"true"
Value
=
'1'
NumberFormat-DecimalDigits
=
"0"
Skin
=
"Bootstrap"
>
</
telerik:RadNumericTextBox
>
<
img
class
=
"product-image"
src='<%# DataBinder.Eval(Container, "Value")%>'>
<
span
class
=
"product-title"
><%# DataBinder.Eval(Container, "Text")%></
span
>
</
ItemTemplate
>
</
telerik:RadListBox
>
I want to set the RadNumericTextBox value in the databound event
I have tried the following:
Protected Sub RadListBox1_ItemDataBound(sender As Object, e As RadListBoxItemEventArgs) Handles RadListBox1.ItemDataBound
If TypeOf e.Item Is RadListBoxItem Then
Dim item = CType(e.Item, RadListBoxItem)
Dim ItemNo As RadNumericTextBox = CType(item.FindControl("ItemNo"), RadNumericTextBox)
ItemNo.Value = e.Item.DataItem("SectionSort_ItemNo")
End If
End Sub
But I get this:
Specified cast is not valid.
based on this line
ItemNo.Value = e.Item.DataItem("SectionSort_ItemNo")
So basically how do i set the value of the text box in the databound event?