Hi,
Unfortunately I couldn't replicate the issue at my end. Please have a look into the sample code snippet which works fine at my end.
ASPX:
<
telerik:RadComboBox
ID
=
"cboBenchmarkCompanies"
runat
=
"server"
CheckBoxes
=
"true"
DataTextField
=
"CountryName"
DataValueField
=
"CountryId"
/>
<
telerik:RadButton
ID
=
"radbtnCheckedItems"
runat
=
"server"
Text
=
"CheckedItems"
OnClick
=
"radbtnCheckedItems_Click"
>
</
telerik:RadButton
>
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
DataTable data = GetData(
new
SqlCommand(
"SELECT CountryName,CountryId FROM Country"
));
cboBenchmarkCompanies.DataSource = data; ;
cboBenchmarkCompanies.DataBind();
}
}
protected
void
radbtnCheckedItems_Click(
object
sender, EventArgs e)
{
int
checkeditemsCount=cboBenchmarkCompanies.CheckedItems.Count;
foreach
(Telerik.Web.UI.RadComboBoxItem item
in
cboBenchmarkCompanies.CheckedItems)
{
//your code
}
}
private
static
DataTable GetData(SqlCommand selectCommand)
{
selectCommand.Connection =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"ConnectionString"
].ConnectionString);
SqlDataAdapter adapter =
new
SqlDataAdapter(selectCommand);
DataTable data =
new
DataTable();
adapter.Fill(data);
return
data;
}
Please provide your full code if it doesn't help.
Thanks,
Shinu.