AUTHOR: Patrick McDonough
DATE POSTED: August 15, 2018
Along with using a RadAjaxManager, an application can include cascading RadComboBoxes as shown in the RadComboBox Cascading ComboBoxes live demo. Additionally, the component offers selection with checkboxes. Combining the implementations can be achieved, and in return, allow the user to select multiple values to determine what dataitems are available in the related RadComboBox.
<
table
>
tr
td
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
"server"
AutoPostBack
"true"
DataValueField
"DepartmentID"
DataTextField
"DepartmentName"
EmptyMessage
"Select A Department"
CheckBoxes
OnSelectedIndexChanged
"RadComboBox1_SelectedIndexChanged"
</
"RadComboBox2"
"ItemID"
"ItemName"
protected
void
RadComboBox1_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
var combo = sender
as
RadComboBox;
var checkedItems = combo.CheckedItems;
RadComboBox2.DataSource = GetItems(checkedItems);
RadComboBox2.DataBind();
}
1. When a user checks items in RadComboBox1 and closes the dropdown, the selectedIndexChanged event will fire. 2. During this event, reference the RadComboBox and its checkeditems. 3. Set the datasource of the second RadComboBox, and use DataBind().
Ajaxify the RadComboBoxes To ensure postback does not disrupt performance every time you select a checkbox, use Ajax like in this live demo. Using the same RadComboBoxes from above, here's the implementation with the RadAjaxManager:
telerik:RadAjaxManager
"RadAjaxManager1"
AjaxSettings
telerik:AjaxSetting
AjaxControlID
UpdatedControls
telerik:AjaxUpdatedControl
ControlID
/>
Resources Buy Try