Hi!
i am trying to populate and select all items of the following RadComboBox:
<
telerik:RadDropDownList
ID
=
"RadDropDownParameterX"
runat
=
"server"
DropDownHeight
=
"120px"
Width
=
"120px"
Skin
=
"BlackMetroTouch"
DropDownWidth
=
"120px"
OnSelectedIndexChanged
=
"RadDropDownParameterX_SelectedIndexChanged"
AutoPostBack
=
"true"
>
<
Items
>
<
telerik:DropDownListItem
Text
=
"Countries"
Value
=
"Countries"
Selected
=
"true"
/>
<
telerik:DropDownListItem
Text
=
"Sites"
Value
=
"Sites"
/>
<
telerik:DropDownListItem
Text
=
"Rts"
Value
=
"Rts"
/>
<
telerik:DropDownListItem
Text
=
"Machines"
Value
=
"Machines"
/>
<
telerik:DropDownListItem
Text
=
"Protocols"
Value
=
"Protocols"
/>
</
Items
>
</
telerik:RadDropDownList
>
With the following code/logic:
Protected
Sub
Page_Load(sender
As
Object
, e
As
System.EventArgs)
If
Not
Page.IsPostBack
Then
LoadCountries()
Dim
collectionAllCountries
As
IList(Of RadComboBoxItem)
collectionAllCountries = RadComboBoxCountries.Items
For
Each
item
As
RadComboBoxItem in collectionAllCountries
item.Selected = true
Next
...
...
...
Public
Sub
LoadCountries()
Dim
ListaAllCountries
As
List(Of AffideaGeneralWeb.BLL.General.Countries)
ListaAllCountries = AffideaGeneralWeb.BLL.General.Countries.GetCountries()
Dim
dataCountries
As
DataTable =
New
DataTable()
dataCountries.Columns.Add(
"text"
)
dataCountries.Columns.Add(
"value"
)
For
Each
c
As
AffideaGeneralWeb.BLL.General.Countries
In
ListaAllCountries
Dim
currentRow
As
DataRow = dataCountries.NewRow()
currentRow(
"text"
) = c.Title
currentRow(
"value"
) = c.ID
dataCountries.Rows.Add(currentRow)
Next
RadComboBoxCountries.DataSource = dataCountries
RadComboBoxCountries.DataBind()
End
Sub
However even if items are populated (so LoadCountries() works and binds datasource to RadComboBox) the code that i am using to select items does not select them in fact (check screenshot)!
Am i missing something here?