This seems to be happening in more recent versions. With that said, here we go...
So let's say I have a RadComboBox(refered to a RCB from here forward) set up in the following manner:
<
telerik:RadComboBox
ID
=
"cbAcctType"
runat
=
"server"
DataValueField
=
"ACCT_TYPE_ID"
DataTextField
=
"acct_code"
RenderMode
=
"Classic"
AutoPostBack
=
"True"
CausesValidation
=
"False"
Width
=
"100%"
DropDownWidth
=
"400px"
HighlightTemplatedItems
=
"True"
InputCssClass
=
"required_cb"
EnableLoadOnDemand
=
"true"
AppendDataBoundItems
=
"True"
>
<
ItemTemplate
>
<
asp:Table
runat
=
"server"
CellPadding
=
"0"
CellSpacing
=
"0"
Width
=
"100%"
GridLines
=
"None"
>
<
asp:TableRow
>
<
asp:TableCell
Width
=
"30%"
>
<%# DataBinder.Eval(Container.DataItem, "acct_code") %>
</
asp:TableCell
>
<
asp:TableCell
Width
=
"70%"
>
<%# DataBinder.Eval(Container.DataItem, "acct_description") %>
</
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
and it's databound via code in the code behind. All that works fine. Now when my form loads I obviously set RCB value. I have a function to do this:
Public
Shared
Function
SetRadCombByVal(
ByVal
ddl
As
Telerik.Web.UI.RadComboBox,
ByVal
val
As
String
)
As
Boolean
If
val =
""
Or
val.Trim.Length <= 0
Then
Return
False
End
If
If
ddl.Items.Count = 0
Then
Return
False
End
If
ddl.SelectedIndex = -1
Try
ddl.FindItemByValue(val.Trim).Selected =
True
Catch
ex
As
Exception
Return
False
End
Try
If
ddl.SelectedIndex < 0
Then
Return
False
End
If
Return
True
End
Function
this also works fine with one caveat. Lets say the RCB is data bound with the following values A, B, C, D. When you bind the RCB it defaults to the 1st in the list being selected. So the Text area of the RCB contains A. Now when I set the RCB via my function to let's say C...the row becomes the selected row, but the Text area of the RCB continues to contain A making it look like the operation of setting the RCB to the proper value didn't work. Subsequently, I've had to add the following code:
ddl.FindItemByValue(val.Trim).Selected =
True
ddl.Text = ddl.SelectedItem.Text.ToString
'This ones the new line.
Seems a bit ridiculous and redundant to have to add that. If need be, I can setup a whole project to showcase my findings.