36

Do any good multi-select dropdownlist with checkboxes (webcontrol) exist for asp.net?

Thanks a lot

David Sykes
  • 48,469
  • 17
  • 71
  • 80
Jan Remunda
  • 7,840
  • 8
  • 51
  • 60

8 Answers8

39

You could use the System.Web.UI.WebControls.CheckBoxList control or use the System.Web.UI.WebControls.ListBox control with the SelectionMode property set to Multiple.

knut
  • 4,699
  • 4
  • 33
  • 43
28

jQuery Dropdown Check List can be used to transform a regular multiple select html element into a dropdown checkbox list, it works on client so can be used with any server side technology:

alt text
(source: googlecode.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Aleris
  • 7,981
  • 3
  • 36
  • 42
  • 1
    I think this solution is just what the question asked for! Very solid alternative! – Nicolas De Irisarri Aug 14 '09 at 15:20
  • 5
    But in C# codebehind, how would we access the checked list? with the accepted answer we can use foreach(ListItem li in listBox1.Items){if(li.Selected){myList.Add(listItem.Text); } } – Matt Oct 29 '13 at 16:23
  • 2
    @Matt the transformation is purely visual. In the serverside, this can still be a regular `asp:ListBox` control (and yes, I'm aware that I'm replying to a nearly 10 year old question lol). – julealgon Sep 06 '22 at 18:21
6

Try this server control which inherits directly from CheckBoxList (free, open source): http://dropdowncheckboxes.codeplex.com/

Maxim Saplin
  • 4,115
  • 38
  • 29
3

I've used the open source control at http://dropdowncheckboxes.codeplex.com/ and been very happy with it. My addition was to allow a list of checked files to use just file names instead of full paths if the 'selected' caption gets too long. My addition is called instead of UpdateSelection in your postback handler:

// Update the caption assuming that the items are files<br/> 
// If the caption is too long, eliminate paths from file names<br/> 
public void UpdateSelectionFiles(int maxChars) {
  StringBuilder full = new StringBuilder(); 
  StringBuilder shorter = new StringBuilder();
  foreach (ListItem item in Items) { 
    if (item.Selected) { 
      full.AppendFormat("{0}; ", item.Text);
      shorter.AppendFormat("{0}; ", new FileInfo(item.Text).Name);
    } 
  } 
  if (full.Length == 0) Texts.SelectBoxCaption = "Select...";
  else if (full.Length <= maxChars) Texts.SelectBoxCaption = full.ToString(); 
  else Texts.SelectBoxCaption = shorter.ToString();
} 
Moulde
  • 3,438
  • 4
  • 29
  • 38
Mick Bruno
  • 1,373
  • 15
  • 13
1

Check this out. It's free one.

http://irfaann.blogspot.com/2009/07/ajax-based-multiselect-dropdown-control.html

HTH,

  • 1
    This post was flagged as spam and downvoted, but the control appears to be nice and it IS free, so it gets my upvote. Maybe irfan can give you some free technical support in exchange for the link. :) – Robert Harvey Aug 04 '09 at 18:21
  • Agreed. This was probably blocked by many peope's websense filter which is such a stupid thing to have to concern my time with when I could be solving important problems. – Christopher Elliott Jan 09 '10 at 06:52
1

HTML does not support a dropdown list with checkboxes. You can have a dropdown list, or a checkbox list. You could possibly fake a dropdowncheckbox list using javascript and hiding divs, but that would be less reliable than just a standard checkbox list.

There are of course 3rd party controls that look like a dropdown checkboxlist, but they are using the div tricks.

you could also use a double listbox, which handles multi select by moving items back and forth between two lists. This has the added benefit of being easily to see all the selected items at once, even though the list of total items is long

(Imagine a list of every city in the world, with only the first and last selected)

Jason Coyne
  • 6,509
  • 8
  • 40
  • 70
1

I like the Infragistics controls. The WebDropDown has what you need. The only drawback is they can be a bit spendy.

JP Alioto
  • 44,864
  • 6
  • 88
  • 112
0

Here's a cool ASP.NET Web control called Multi-Select List Field at http://www.xnodesystems.com/. It's capable of:

(1) Multi-select; (2) Auto-complete; (3) Validation.