I am using RadComboBox control with checkbox.
On "RadComboBox2_ItemsRequested" event, I need to set the checkbox for specific items in the combobox.
Can somebody guide me how this can be achieved. I tried many different ways, but was unable to set the checkbox from server side on this event.
Thanks
9 Answers, 1 is accepted
As far as I understand - you want to use the CheckBoxes feature of RadComboBox along with Load On Demand.
I am afraid that this is not a supported scenario - please take a look at this help article.
The RadComboBox items loaded via Load On Demand are not accessible at server-side.
However the CheckBoxes feature needs to access the items at server-side - and that is why the simultaneous usage of these two features is not supported.
Regards,
Kalina
the Telerik team

Thanks for the reply.
Not sure why you say,
"The RadComboBox items loaded via Load On Demand are not accessible at server-side."
I am very well able to access the items on server side. For example whatever items checked before, I am able to reset the values to something else when it calls the routine for Load on Demand next time. Its just that the setting of the checkbox is not working.
Is there any workaround for this issue, set the checkbox in load on demand.
Thanks

The functionality I am trying to achieve is,
1. Allow multiselect values
2. I should be able to get back all the selections on server side "Load On demand" when user clieck on the control again.
Thanks
Regarding your last question - you can try using RadAutoCompleteBox.
I am afraid that in order to provide you more precise answer I will need more details about your scenario
What you mean by "I am very well able to access the items on server side"?
How exactly do you access the RadComboBox items at server-side?
Please paste here a working code that illustrates your implementation.
Thank you in advance.
Greetings,
Kalina
the Telerik team

below is the code snippet I am using to achive the functionality.
protected void RadComboBox2_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
int currGridIndex = myIndexofItemInEditMode;
string mySelectedData = DataFields[currGridIndex].MyCriterion.ToString();
RadComboBox propertyComboBox = (RadComboBox)rcItem.FindControl("RadComboBox2");
int itemOffset = e.NumberOfItems;
int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);
e.EndOfItems = endOffset == data.Rows.Count;
// check the box for previously selected items
String[] myTmpArray = mySelectedData.Split(m_CharToSplit_pipe, StringSplitOptions.RemoveEmptyEntries);
for (int i = itemOffset; i < endOffset; i++)
{
String currValue = data.Rows[i][myPropertySN].ToString();
RadComboBoxItem myRItem = new RadComboBoxItem(currValue, currValue);
myRItem.Checked = true;
propertyComboBox.Items.Add(myRItem);
rcItem.DataBind();
if (myTmpArray.Contains("'" + currValue + "'"))
{
RadComboBoxItem item1 = propertyComboBox.SelectedItem;
item1.Checked = true;
}
}
}
I am able to do that & for the previously selected fields the values are changed. But unable to check the previously selected check box.
Please check the screen shot.
Not sure if I have any confusing statments in my post. But I will be curious how AutoCompleteBox will help me achive the same. What I am trying to achieve is simple,
- Get a RadComboBox style dropdown OR something like ListBox where users can select more than one value.
Here are actual steps:
- A RagGrid is displayed to the user.
- When user click on "Edit" (renamed to "Filter") link it shows them the RadComboBox.
- When they actually click on RadComboBox, I try to go grab data from datasource & attach to RaDCombo. & then they can select on the checkbox against each value in RadComboBox
The problem is everytime they select some values in dropdown, & click update. If they want to comeback & check/uncheck any value. The RadComboBox resets all the selected values.
What I am trying to achieve then is, get any previously selected values (check screenshots) everytime they click on ComboBox & recheck the previously selected checkbox. Please see the screenshot.
Thank you

You can add some checked items in combo at ItemDataBound event of the grid:
protected void OnItemDataBoundHandler(object sender, GridItemEventArgs e)
{
if (e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
if (!(e.Item is IGridInsertItem))
{
RadComboBox combo = (RadComboBox)item.FindControl("RadComboBox1");
RadComboBoxItem checkedItem = new RadComboBoxItem();
selectedItem.Text = ((DataRowView)e.Item.DataItem)["Name"].ToString();
selectedItem.Value = ((DataRowView)e.Item.DataItem)["ID"].ToString();
combo.CheckedItems.Add(checkedItem);
}
}
}
However it is not good idea to use the LOD and the checkboxes at the same time.

Just wondering if you ever got Combobox with check boxes and load on demand works after postback even if you have another solution that will be great.
Thanks

CheckBox is not supported with Load On Demand . The reason is that RadComboBox's items loaded on demand are not accessible on the server which is needed for the CheckBox feature. On Load on Demand from server side you can access only the Text and SelectedValue property.
Thanks,
Princy.
