Hi experts,
I have ComboBox with CheckBox items. In such a case multiple items can be selected. However, the top part of the ComboBox where the selected items should appear displays only one. Another problem with it is that even if no items are selected it shows the first item. The last problem I noticed is that if I click on one if the checkboxes (without checking it), the selected item display line displays it even though I only clicked it without checking it.
Am I doing something wrong? I it is a known issue, is there a workaround?
Thanks,
Avi
5 Answers, 1 is accepted
RadComboBox supports Item Templates in which you could put another controls, however it does not support every different case in which they could be used.
For instance, the 'RadComboBox with CheckBoxes' approach you are describing. You should add your custom client-side logic, which would implement the desired requirements.
For your convenience I have attached a sample project, which demonstrates such an approach. You could further modify or reuse it to best achieve the desired goals.
I hope it is helpful.
Greetings,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Is it possible to have a modified version of this sample code where the RadCombox and its items/checkboxes are dynamically created in the code behing?
Thanks.
Please check out the following online help topic on RadComboBox: Adding Templates and especially the Adding templates at runtime section. Similarly, RadComboBox could be built in the code-behind.
The CheckBoxTemplate class would look like this:
class CheckBoxTemplate : ITemplate |
{ |
public void InstantiateIn(Control container) |
{ |
CheckBox checkBox = new CheckBox(); |
checkBox.ID = "CheckBox"; |
checkBox.DataBinding += new EventHandler(checkBox_DataBinding); |
container.Controls.Add(checkBox); |
} |
private void checkBox_DataBinding(object sender, EventArgs e) |
{ |
CheckBox target = (CheckBox)sender; |
RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; |
string itemText = (string)DataBinder.Eval(item, "Text"); |
target.Text = itemText; |
} |
} |
I hope this helps.
Best wishes,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Error 4 '_Default' does not contain a definition for 'RadComboBox1' and no extension method 'RadComboBox1' accepting a first argument of type '_Default' could be found (are you missing a using directive or an assembly reference?) D:\_LearningProjects\TelerikTest\TelerikTest\Default.aspx.cs 20 18 TelerikTest
Error 5 '_Default' does not contain a definition for 'Label1' and no extension method 'Label1' accepting a first argument of type '_Default' could be found (are you missing a using directive or an assembly reference?) D:\_LearningProjects\TelerikTest\TelerikTest\Default.aspx.cs 26 14 TelerikTest
I am simply trying test the sample you mentioned. I tried adding
using
Telerik.Web.UI; to the default.aspx.cs and that did not help.
ther than this, It gave me an error that it couldn't find "Telerik.Charting.Dll"..I removed that reference from the web.connfig
Also notice that in your sample project, you have two zip files one with Telerik.Web.UI.Dll and other with RadComboBox.Net2.dll. I am not sure which one to use? I tried adding reference to both DLL's but nothing worked.
Help.
Thanks