I am trying to figure out how to set Checked values in a databound Combobox, using the Q2-2011 version of the control - as seen in this demo:
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/checkboxes/defaultvb.aspx
the code below does not seem to be setting the checked values correctly, specifically this line:
The scenario - I am inserting RadComboBoxes into a Placeholder in a Repeater on ItemCreated. This all works great, I get the comboboxes, the data shows up in the drop down, and I have the Checkboxes, can multi-select, etc. I just can't seem to set the initial values with the .checked = true
Any ideas?
I understand this is a new feature of the Combobox and can't seem to find any examples of how this should be done.
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/checkboxes/defaultvb.aspx
the code below does not seem to be setting the checked values correctly, specifically this line:
UDFControl.FindItemByValue(tItem).Checked =
True
The scenario - I am inserting RadComboBoxes into a Placeholder in a Repeater on ItemCreated. This all works great, I get the comboboxes, the data shows up in the drop down, and I have the Checkboxes, can multi-select, etc. I just can't seem to set the initial values with the .checked = true
col1.DataType =
GetType
(
String
)
col2.DataType =
GetType
(
String
)
tData.Columns.Add(col1)
tData.Columns.Add(col2)
Dim
tCodes
As
String
() = UDF_Data.Rows(currentIndex)(
"Codes"
).ToString.Split(uSVM)
Dim
tDescriptions
As
String
() = UDF_Data.Rows(currentIndex)(
"Descriptions"
).ToString.Split(uSVM)
For
i = 0
To
tCodes.Count - 1
Dim
row
As
DataRow = tData.NewRow
row(col1) = tCodes(i)
row(col2) = tDescriptions(i)
tData.Rows.Add(row)
Next
Dim
UDFControl
As
New
Telerik.Web.UI.RadComboBox
UDFControl.ID = UDF_Data.Rows(currentIndex)(
"ID"
).ToString.Replace(
"*"
,
"_"
)
e.Item.FindControl(
"UDF"
).Controls.Add(UDFControl)
UDFControl.DataSource = tData
UDFControl.DataTextField =
"Desc"
UDFControl.DataValueField =
"ID"
UDFControl.DataBind()
UDFControl.Width =
"204"
UDFControl.CheckBoxes =
True
UDFControl.EnableCheckAllItemsCheckBox =
True
UDFControl.EmptyMessage =
"Select One or More Values"
Dim
tValues
As
String
() = UDF_Data.Rows(currentIndex)(
"Value"
).ToString.Split(uSVM)
For
Each
tItem
As
String
In
tValues
If
UDFControl.FindItemByValue(tItem) IsNot
Nothing
Then
UDFControl.FindItemByValue(tItem).Checked =
True
End
If
Next
Any ideas?
I understand this is a new feature of the Combobox and can't seem to find any examples of how this should be done.