Multi select combobox column

19 posts, 0 answers
  1. nayenez
    nayenez avatar
    3 posts
    Member since:
    Aug 2009

    Posted 31 Aug 2009 Link to this post

    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 ?
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 01 Sep 2009 Link to this post

    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.
  3. nayenez
    nayenez avatar
    3 posts
    Member since:
    Aug 2009

    Posted 01 Sep 2009 Link to this post

    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.
  4. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 01 Sep 2009 Link to this post

    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.
  5. Guillaume
    Guillaume avatar
    2 posts
    Member since:
    Jan 2013

    Posted 21 Jan 2013 Link to this post

    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!

  6. Nikolay
    Admin
    Nikolay avatar
    1805 posts

    Posted 21 Jan 2013 Link to this post

    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.
  7. Harry
    Harry avatar
    1 posts
    Member since:
    Oct 2013

    Posted 17 Oct 2013 Link to this post

     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.
  8. Dimitar
    Admin
    Dimitar avatar
    2686 posts

    Posted 21 Oct 2013 Link to this post

    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 >>
  9. Tomasz
    Tomasz avatar
    6 posts
    Member since:
    Oct 2013

    Posted 30 Oct 2014 in reply to Dimitar Link to this post

    Hi,
    Could you update multiselectcombobox to current version of telerik?
    Some classes are obsolete for example RadListBoxItemCollection.
    Thanks

    Regards
    Tom
  10. Dimitar
    Admin
    Dimitar avatar
    2686 posts

    Posted 31 Oct 2014 Link to this post

    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.

     
  11. Tomasz
    Tomasz avatar
    6 posts
    Member since:
    Oct 2013

    Posted 31 Oct 2014 in reply to Dimitar Link to this post

    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
  12. Dimitar
    Admin
    Dimitar avatar
    2686 posts

    Posted 05 Nov 2014 Link to this post

    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.

     
  13. Tasos
    Tasos avatar
    9 posts
    Member since:
    Dec 2012

    Posted 26 Dec 2014 in reply to Dimitar Link to this post

    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
  14. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 29 Dec 2014 Link to this post

    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.

     
  15. Tasos
    Tasos avatar
    9 posts
    Member since:
    Dec 2012

    Posted 29 Dec 2014 in reply to Stefan Link to this post

    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
  16. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 31 Dec 2014 Link to this post

    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.

     
  17. Tasos
    Tasos avatar
    9 posts
    Member since:
    Dec 2012

    Posted 01 Jan 2015 in reply to Stefan Link to this post

    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
  18. Dimitar
    Admin
    Dimitar avatar
    2686 posts

    Posted 05 Jan 2015 Link to this post

    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.

     
  19. Tasos
    Tasos avatar
    9 posts
    Member since:
    Dec 2012

    Posted 05 Jan 2015 in reply to Dimitar Link to this post

    Thank you very much Dimitar works fine for me.
Back to Top