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

Multi select combobox column

20 Answers 1095 Views
GridView
This is a migrated thread and some comments may be shown as answers.
nayenez
Top achievements
Rank 1
nayenez asked on 31 Aug 2009, 09:15 AM
Hello,

I'd like to add multi-select combobox column to my grid. I found an example of multi select combobox control in code library but I'm having trouble converting it to something that can be embedded in grid cell.

Can someone help ?

20 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 01 Sep 2009, 08:24 AM
Hello nayenez,

Basically you have to add GridViewMultiComboBoxColumn and set its DataSource, ValueMember, and DisplayMember properties. Here is a sample:

GridViewMultiComboBoxColumn multiComboColumn = new GridViewMultiComboBoxColumn("Items"""); 
multiComboColumn.DataSource = items; 
multiComboColumn.ValueMember = "ID"
multiComboColumn.DisplayMember = "Name"
this.radGridView1.Columns.Add(multiComboColumn); 

If you have any other questions, don't hesitate to contact us back.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
nayenez
Top achievements
Rank 1
answered on 01 Sep 2009, 09:14 AM
Hello Jack,

Thanks for answering but I think there is a misunderstanding. I didn't mean MultiComboBoxColumn but multi-select combobox column - a column which has combobox with the ability to select more than one entry (each entry has a checkbox next to it).

There is an example here http://www.telerik.com/community/code-library/winforms/combobox-and-listbox/radmultiselectcombobox.aspx
I'd like such functionality in grid column.
0
Jack
Telerik team
answered on 01 Sep 2009, 01:15 PM
Hello nayenez,

I apologize for this mistake. Now I understand what you want to achieve. Yes, you can use the code from this KB article as a base for a multi-select combo box column. Basically you should create a custom editor by inheriting the standard RadComboBoxEditor. You can find more information regarding this behavior in our online documentation. Please check also "GridView -> Custom Editors" example in our demo application.

Handle EditorRequired event to replace the default editor in RadGridView:

void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) 
    if (e.EditorType == typeof(RadComboBoxEditor)) 
    { 
        e.EditorType = typeof(CustomComboBoxEditor); 
    } 

You can use a standard combobox column to host the editor:

GridViewLookUpColumn combo = new GridViewLookUpColumn("Items"); 
combo.DataType = typeof(string);             
this.radGridView1.Columns.Add(combo); 

Find the rest of the code in the attached C# file. I hope it helps. Should you have any questions, don't hesitate to ask.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Guillaume
Top achievements
Rank 1
answered on 21 Jan 2013, 04:15 PM
Hi,
I'm also trying to get a multi select combobox working inside a gridview column. I want the combobox's ItemsSource to be linked to an observable collection. I'm using  WPF radcontrols version Q3 2011 and the sample code provided is deprecated.

What would be the right way to do this with a newer radcontrols API?

Thanks!

0
Nikolay
Telerik team
answered on 21 Jan 2013, 04:38 PM
Hi Guillaume,

Please note that the current thread concerns the Windows Forms technology and suite rather than the WPF ones. I would kindly ask you to open a new thread in the appropriate forum section. This will allow those of our community who are interested in the same functionality for WPF to find the answer more easily. Thank you for your understanding.

All the best,
Nikolay
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Harry
Top achievements
Rank 1
answered on 17 Oct 2013, 05:13 AM
 Hi,
     I need a combo box column which is capable of selecting multiple items from it. I refereed the KB article at this DEMO. which works fine for me. But i can not read values from it and can not set selected values in data binding.

Hope i am clear ...Please help.

Thanks.
0
Dimitar
Telerik team
answered on 21 Oct 2013, 03:11 PM
Hi Harry,

Thank you for contacting Telerik support.

If I understand you correctly you are trying to combine the solution from this article with this one. In this case you can use the first example and bind the grid to a datasource like this:
public Form1()
        {
            InitializeComponent();
            DataTable t = new DataTable();
            DataTable s = new DataTable();
            s.Columns.Add("MutiSelect column", typeof(int[]));
            s.Rows.Add(new int[] { 9, 6, 10 });
            s.Rows.Add(new int[] { 5, 1, 3 });
            s.Rows.Add(new int[] { 8, 7 });
            s.Rows.Add(new int[] { 4, 2, 1 });
 
            t.Columns.Add("ID", typeof(int));
            t.Columns.Add("Name", typeof(string));
            t.Rows.Add(1, "one");
            t.Rows.Add(2, "two");
            t.Rows.Add(3, "three");
            t.Rows.Add(4, "four");
            t.Rows.Add(5, "five");
            t.Rows.Add(6, "six");
            t.Rows.Add(7, "seven");
            t.Rows.Add(8, "eight");
            t.Rows.Add(9, "nine");
            t.Rows.Add(10, "ten");
 
           
            radGridView1.AutoGenerateColumns = false;
            radGridView1.DataSource = s;
 
            CustomColumn col = new CustomColumn("MutiSelect column");
            col.DataSource = t;
            col.DisplayMember = "Name";
            col.ValueMember = "ID";
            radGridView1.Columns.Add(col);        
        }

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Tomasz
Top achievements
Rank 1
answered on 30 Oct 2014, 05:44 PM
Hi,
Could you update multiselectcombobox to current version of telerik?
Some classes are obsolete for example RadListBoxItemCollection.
Thanks

Regards
Tom
0
Dimitar
Telerik team
answered on 31 Oct 2014, 10:50 AM
Hi Jan,

Thank you for writing.

Please note that currently we support multi select drop down list out of the box. You can find detailed information about it here: CheckedDropDownList. The control can be used as editor in RadGridView as well: Use as RadGridView editor.

I hope this helps.

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tomasz
Top achievements
Rank 1
answered on 31 Oct 2014, 12:10 PM
Hi Dimitar,
I have been waiting for this functionality but in example http://www.telerik.com/help/winforms/dropdown-and-listcontrol-checked-dropdownlist-how-to-use-as-radgridview-editor.html
I have problem with GridViewCheckedDropDownListEditor.
I have  error:
"Error 10 The type or namespace name 'GridViewCheckedDropDownListEditor' could not be found (are you missing a using directive or an assembly reference?)"
Could you little help me?
Regards,
Tom
0
Dimitar
Telerik team
answered on 05 Nov 2014, 10:52 AM
Hello Tom,

Thank you for writing.

It appears that there is a problem in our documentation page and the code is not listed there (we will fix this as soon as possible). Nevertheless the code for the editor should look like this:
public class GridViewCheckedDropDownListEditor : RadCheckedDropDownListElement
       {
           public override object Value
           {
               get
               {
                   return this.Text;
               }
               set
               {
                   this.Text = value + "";
               }
           }
       }

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tasos
Top achievements
Rank 1
answered on 26 Dec 2014, 09:15 PM
Hi
i following the example, but what type can be the column of grid with this editor?
How can i store and retrieve then changes of this column?

Best Regards 
Tasos
0
Stefan
Telerik team
answered on 29 Dec 2014, 08:50 AM
Hello Tasos,

In the example, the column is added with this code: 
this.radGridView1.Columns.Add("CheckedDropDownListColumn");

This will add by default a GridViewTextBoxColumn.

I hope this helps.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tasos
Top achievements
Rank 1
answered on 29 Dec 2014, 12:48 PM
Hi 
This means that i must have a text field for this column?
if there are ids for each item in checkdropdown list what is the type for radgridview column?

Best Regards
0
Stefan
Telerik team
answered on 31 Dec 2014, 02:13 PM
Hello,

That is correct. The example uses text field and its values are separated with ';'. Here is an example:
DataTable table = new DataTable();
table.Columns.Add("col1");
table.Columns.Add("col2");
 
table.Rows.Add("Model 1;Model 4;", "value1");
table.Rows.Add("Model 3;Model 5;", "value2");
 
radGridView1.DataSource = table;

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tasos
Top achievements
Rank 1
answered on 02 Jan 2015, 05:25 AM
Hello and Happy New Year
Can you give me an example please, how can i store integers but to show text (descriptions)?
Can i use a second table to store my selections which they be integers, but the column to show me the description if the selected IDs?

Best Regards
0
Dimitar
Telerik team
answered on 05 Jan 2015, 04:27 PM
Hi Tassos,

Thank you for writing back.

I have created a small sample where you can see how to convert the integer values to strings and vice versa. Please note that when you are not in edit mode the cell is always displaying text (you can display anything you want regardless of the value). This means that the value should be converted when the user begins or ends editing a particular cell. This is done by overriding the Value property of the editor - so when the editor is initialized the value is converted to string and when the user ends the edit, the value is converted back to integer. 

I hope this will be useful.

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tasos
Top achievements
Rank 1
answered on 05 Jan 2015, 06:19 PM
Thank you very much Dimitar works fine for me.
0
song wan
Top achievements
Rank 1
answered on 06 Jun 2020, 07:34 PM

Hello Jack I am new to Telerik.

my VS can't find RadComboxEditor, RadComboBoxItem and others. 

Can you tell me where they are located?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Jun 2020, 04:58 AM
Hello, Song Wan, 

I suppose that you are using the latest version of the Telerik UI for WinForms suite. 

I would like to note that RadComboBox has been replaced by RadDropDownList. RadGridView now uses a RadDropDownListEditor: https://docs.telerik.com/devtools/winforms/controls/gridview/editors/default-editors 

In case you want to allow multiple selection in the grid's editor, the following help article demonstrates how adopt RadCheckedDropDownList as an editor: https://docs.telerik.com/devtools/winforms/controls/dropdown-listcontrol-and-checkeddropdownlist/checkeddropdownlist/how-to/use-as-radgridview-editor    

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
GridView
Asked by
nayenez
Top achievements
Rank 1
Answers by
Jack
Telerik team
nayenez
Top achievements
Rank 1
Guillaume
Top achievements
Rank 1
Nikolay
Telerik team
Harry
Top achievements
Rank 1
Dimitar
Telerik team
Tomasz
Top achievements
Rank 1
Tasos
Top achievements
Rank 1
Stefan
Telerik team
song wan
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or