Multiselect DropDownList Retreive selected items

6 posts, 0 answers
  1. Richard
    Richard avatar
    20 posts
    Member since:
    Sep 2010

    Posted 02 Dec 2010 Link to this post

    I'm currently using a multiselect enabled dropdownlist.  How do I retreive the list of 'selected' items in the multiselect dropdownlist?

    Thanks.
  2. Richard
    Richard avatar
    20 posts
    Member since:
    Sep 2010

    Posted 02 Dec 2010 Link to this post

    Never Mind.  I figured it out.  If anyone is interested in seeing the solution, please ask in a reply and I'll post the code.

    Thx.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 07 Dec 2010 Link to this post

    Hi Richard,

    Thank you for writing.

    By default RadDropDownList control does not support multiple selection due to Close operation on mouse click.

    We will be glad if you share your solution with community.

    Regards,
    Peter
    the Telerik team
    Get started with RadControls for WinForms with numerous videos and detailed documentation.
  5. Nathaniel
    Nathaniel avatar
    12 posts
    Member since:
    Feb 2009

    Posted 27 Jul 2011 Link to this post

    Richard,

    I would like to see your code please.
  6. Richard
    Richard avatar
    20 posts
    Member since:
    Sep 2010

    Posted 27 Jul 2011 Link to this post

    GetProjectList = "" 
    Dim intCount As Integer = 0 
      
    For intCount = 0 To (Me.cboPinProject.EditorControl.SelectedRows.Count - 1) 
       GetProjectList = GetProjectList & "'" & Me.cboPinProject.EditorControl.SelectedRows.Item(intCount).Cells(0).Value & "'," 
    Next intCount 
      
    GetProjectList = Mid(GetProjectList, 1, GetProjectList.Length - 1)

     

     

    In the above code, I initialize a string variable 'GetProjectList'.  I also initialize a loop counter 'intCount'
    Then I loop through the 'Me.cboPinProject.EditorControl.SelectedRows.Count-1'
    In the loop I can reference the 'Me.cboPinProject.EditorControl.SelectedRows.Item(intCount).Cells(0).Value'

    Note:  'cboPinProject' is the name of the dropdownlist  and ...Cells(0) is a reference to the first column in the dropdownlist  (my dropdownlist has two columns)

     

  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 01 Aug 2011 Link to this post

    Hi Richard,

    By looking at your code I can assume that you are using RadMultiColumnComboBox. In fact it also does not support multiple row selection. However, you can work around this limitation by using a RadDropDownButton and hosting RadGridView as a child item. Please consider the following code snippet:
    RadGridView grid = newRadGridView();
    grid.BindingContext = newSystem.Windows.Forms.BindingContext();
    grid.DataSource = table;
    grid.Size = newSystem.Drawing.Size(200, 200);
      
    RadDropDownButton menu = newRadDropDownButton();
    menu.Text = "DropDown";
    menu.Items.Add(newRadMenuHostItem(grid));
    menu.Location = newPoint(10, 10);
    menu.Size = newSize(100, 20);
    this.Controls.Add(menu);

    If you have further questions, do not hesitate to ask.
     
    Best wishes,
    Jack
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top
UI for WinForms is Visual Studio 2017 Ready