I have the following Combobox
<
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 I bind it with the following code:
cbAcctType.DataSource = ds.Tables(
"AcctType"
)
cbAcctType.DataBind()
Sometimes the code associated with an account will expire and no longer be available in the available list, but it still exists so I have to individually retrieve it and add it to the combobox list. Here is my code for that process
Dim
oItem
As
New
RadComboBoxItem
oItem.DataItem = ds.Tables(0).Rows(0)
oItem.Value = ds.Tables(0).Rows(0).Item(
"ACCT_TYPE_ID"
).ToString
oItem.Text = ds.Tables(0).Rows(0).Item(
"acct_code"
).ToString
oItem.Selected =
True
cbAcctType.Items.Add(oItem)
And that's where the wheels come off. The items is there but only sort of. It will get selected but there is no items in the list. and it usually throws and ASPX page error the <%# DataBinder.Eval(Container.DataItem, "acct_code") %> doesn't exist.
What is the piece of the puzzle that's missing? I have tried it with oItem.DataBind() and that doesn't solve things.