Simple multiselect

9 posts, 0 answers
  1. ns
    ns avatar
    5 posts
    Member since:
    Mar 2010

    Posted 07 May 2010 Link to this post

    Hi,

    When using the RadListbox with SelectionMode set to Multiple, is it possible to allow users to select multiple items just by clicking (without having to hold Ctrl).  This used to be an option with listboxes (options were Simple or Extended) in MS Access but I can't find an ASP.NET listbox with allows this?

  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 10 May 2010 Link to this post

    Hello ns,

    RadListBox does not provide this functionality out of the box but it is rather easy to implement it. I have attached sample to this replay that demonstrates how to do it. Clicking on a item selects it, subsequent click deselects it.

    Greetings,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 14 Feb 2011 Link to this post

    It's worth putting this in the How-To section of Listbox.
    http://www.telerik.com/help/aspnet-ajax/listbox-how-to-transfer-specific-items-with-transferall-button.html
  5. Tammy
    Tammy avatar
    4 posts
    Member since:
    Aug 2011

    Posted 17 Aug 2011 Link to this post

    It works great. However, if I select multiple items, and drag and drop those to different place (for example to the top ), I can't multiple select any two or more items in that group again. It only does single select for the items in 'drag-and-drop' group. If I hold Ctrl, it works as expected.
  6. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 23 Aug 2011 Link to this post

    Hello Tammy,

    I am afraid that I'm having hard time reproducing the problem. How are you trying to select the items? The only way to select multiple items is by pressing ctrl or shift. As far as my tests show, both are working as expected. Could you elaborate on how to reproduce the problem?

    Greetings,
    Genady Sergeev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  7. Tammy
    Tammy avatar
    4 posts
    Member since:
    Aug 2011

    Posted 23 Aug 2011 Link to this post

    Hi,

    I used the example, so I'm able to multiple select without holding the Ctrl key. But after I drag them to a new place, I couldn't multiple select any item in that group without holding Ctrl key. I'm able to multi-select items that are not in dragging group without ctrl key.

    Hope it's clearer.

    -Tammy,
  8. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 26 Aug 2011 Link to this post

    Hello Tammy,

    You can use the following, modified code, to handle this scenario:

    <script type="text/javascript">
            Sys.Application.add_load(function() {
                var listBox = $find("RadListBox1");
                var $ = $telerik.$;
                 
                $(".rlbItem", listBox._getGroupElement()).die("click");
     
                $(".rlbItem", listBox._getGroupElement())
                   .live("click", function(event) {
                       event.ctrlKey = true;
                       listBox._onClick(event);
                   });
            });
         
        </script>


    Kind regards,
    Genady Sergeev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  9. Pieter
    Pieter avatar
    7 posts
    Member since:
    May 2012

    Posted 18 Aug 2013 Link to this post

    Hi Genady!

    Thank you for your solution.

    It has been very helpful, however with the latest upgrade to 2013 q2 it have been receiving the messages:
     - Object doesn't support property or method 'die'
      and
     - Object doesn't support property or method 'live'

    Have anyone else had this problem and is there perhaps a solution?

    Thank you
    PieterDevill
  10. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 22 Aug 2013 Link to this post

    Hello Pieter,

    It is that the die and live methods of jQuery are deprecated and actually removed from the jQuery. Here is the version of the code that uses the latest API for attaching events with jQuery.

    <script type="text/javascript">
              Sys.Application.add_load(function () {
                  var listBox = $find("RadListBox1");
                  var $ = $telerik.$;
     
                  $(listBox._getGroupElement()).unbind("click");
     
                  $(listBox._getGroupElement())
                     .on("click", ".rlbItem", function (event) {
                         event.ctrlKey = true;
                         listBox._onClick(event);
                     });
              });
     
          </script>


    Regards,
    Genady Sergeev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017