This is a migrated thread and some comments may be shown as answers.

ComboBox with CheckBox items

5 Answers 345 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Avi
Top achievements
Rank 1
Avi asked on 11 Mar 2008, 03:04 PM

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

Sort by
0
Simon
Telerik team
answered on 14 Mar 2008, 02:26 PM
Hi Avi,

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
0
relper
Top achievements
Rank 1
answered on 16 Apr 2008, 10:10 PM
Hi,

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.
0
Simon
Telerik team
answered on 18 Apr 2008, 03:46 PM
Hi relper,

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
0
Arunraj
Top achievements
Rank 1
answered on 23 Mar 2009, 08:02 PM
How can I create multilevel checkbox list as in Monster.com -> More Search Options -> Occupations drop down.
0
Arunraj
Top achievements
Rank 1
answered on 26 Mar 2009, 04:22 AM
I am getting the following errors while trying to test the sample

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

Tags
ComboBox
Asked by
Avi
Top achievements
Rank 1
Answers by
Simon
Telerik team
relper
Top achievements
Rank 1
Arunraj
Top achievements
Rank 1
Share this question
or