I am using a radcombobox that I have populated with data from my database. I initially set it up to just display a static title. Now the users want to see the items that have been selected. For the life of me I cannot figure out how to accomplish this.
Can someone please help me? I need it to work EXACTLY like this....MultiSelect CheckBox display . I just can't figure out how to do it.
Thanks,
Ninel
Here is my code:
Can someone please help me? I need it to work EXACTLY like this....MultiSelect CheckBox display . I just can't figure out how to do it.
Thanks,
Ninel
Here is my code:
<script
type
=
"text/javascript"
>
function stopPropagation(e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
}
function RadComboBox_OnClientLoad(sender) {
sender.get_inputDomElement().readOnly = "readonly";
}
</
script
>
<
div
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"rdProjectDeliverables"
Width
=
"215px"
CheckBoxes
=
"true"
Text
=
"Project Deliverables"
AllowCustomText
=
"false"
EnableLoadOnDemand
=
"false"
EmptyMessage
=
"Project Deliverables"
OnClientLoad
=
"RadComboBox_OnClientLoad"
OnClientItemChecked
=
"OnClientItemChecked"
AutoPostBack
=
"true"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
Value
=
""
/>
<
telerik:RadComboBoxItem
Text
=
""
Value
=
""
/>
</
Items
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"CheckBox"
onclick
=
"stopPropagation(event);"
oncheckedchanged
=
"rdProjectDeliverables_CheckedChanged"
AutoPostBack
=
"true"
Text
=
""
/> <%# DataBinder.Eval(Container, "Text") %>
</
ItemTemplate
>
</
telerik:RadComboBox
>
</
div
>
protected void rdProjectDeliverables_CheckedChanged(object sender, EventArgs e)
{
GetMultiSelectDropDownSelections(rdProjectDeliverables);
}
private void GetMultiSelectDropDownSelections(RadComboBox ddl)
{
ArrayList checkedItems = GetCheckedItems(ddl);
foreach (RadComboBoxItem item in checkedItems)
{
//lblMessage.Text = lblMessage.Text + item.Value + "<
br
>";
if (item.Value == "9") //Value of 9 is the value of "Other" which requires a textbox to appear
{
pnlProjectDeliverablesOther.Visible = true;
requestitem.ProjectDeliverablesOther = fldProjectDeliverablesOther.Text;
}
requestitem.RequestId = _requestid;
requestitem.Value = DataHelper.ToInt32(item.Value);
if (_requestorid > 0)
{
requestitem.MultiSelectionSave();
}
}
}
private ArrayList GetCheckedItems(RadComboBox ddl)
{
ArrayList checkedItems = new ArrayList();
foreach (RadComboBoxItem item in ddl.Items)
{
CheckBox checkBox = (CheckBox)item.FindControl("CheckBox");
if (checkBox.Checked)
{
checkedItems.Add(item);
}
}
return checkedItems;
}