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

Simple multiselect

8 Answers 524 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
ns
Top achievements
Rank 1
ns asked on 07 May 2010, 05:36 PM
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?

8 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 10 May 2010, 03:23 PM
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.
0
Lenny_shp
Top achievements
Rank 2
answered on 14 Feb 2011, 10:59 PM
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
0
Tammy
Top achievements
Rank 1
answered on 18 Aug 2011, 01:38 AM
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.
0
Genady Sergeev
Telerik team
answered on 23 Aug 2011, 01:57 PM
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 >>

0
Tammy
Top achievements
Rank 1
answered on 23 Aug 2011, 06:05 PM
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,
0
Genady Sergeev
Telerik team
answered on 26 Aug 2011, 02:32 PM
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 >>

0
Pieter
Top achievements
Rank 1
answered on 18 Aug 2013, 08:52 PM
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
0
Genady Sergeev
Telerik team
answered on 22 Aug 2013, 10:42 AM
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.
Tags
ListBox
Asked by
ns
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Lenny_shp
Top achievements
Rank 2
Tammy
Top achievements
Rank 1
Pieter
Top achievements
Rank 1
Share this question
or