简体   繁体   English

ASP.NET中的多选下拉列表

[英]Multi-select dropdown list in ASP.NET

Do any good multi-select dropdownlist with checkboxes (webcontrol) exist for asp.net? asp.net是否存在带有复选框(webcontrol)的任何好的多选下拉列表?

Thanks a lot 非常感谢

您可以使用System.Web.UI.WebControls.CheckBoxList控件或使用System.Web.UI.WebControls.ListBox控件,并将SelectionMode属性设置为Multiple

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: jQuery Dropdown Check List可用于将常规的多选html元素转换为下拉复选框列表,它可以在客户端上运行,因此可以与任何服务器端技术一起使用:

替代文字
(source: googlecode.com ) (来源: googlecode.com

试试这个直接从CheckBoxList继承的服务器控件(免费,开源): http//dropdowncheckboxes.codeplex.com/

I've used the open source control at http://dropdowncheckboxes.codeplex.com/ and been very happy with it. 我在http://dropdowncheckboxes.codeplex.com/上使用了开源控件,对此非常满意。 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. 我的补充是允许一个已检查文件列表只使用文件名而不是完整路径,如果'selected'标题太长。 My addition is called instead of UpdateSelection in your postback handler: 在回发处理程序中调用我的添加而不是UpdateSelection:

// 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();
} 

HTML does not support a dropdown list with checkboxes. HTML不支持带复选框的下拉列表。 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. 您可以使用javascript和隐藏div来伪造dropdowncheckbox列表,但这不如标准复选框列表那么可靠。

There are of course 3rd party controls that look like a dropdown checkboxlist, but they are using the div tricks. 当然第三方控件看起来像一个下拉复选框列表,但他们正在使用div技巧。

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) (想象一下世界上每个城市的清单,只选择第一个和最后一个城市)

I like the Infragistics controls. 我喜欢Infragistics控件。 The WebDropDown has what you need. WebDropDown拥有您所需要的。 The only drawback is they can be a bit spendy. 唯一的缺点是它们可能有点花钱。

Here's a cool ASP.NET Web control called Multi-Select List Field at http://www.xnodesystems.com/ . 这是一个很酷的ASP.NET Web控件,名为Multi-Select List Field,位于http://www.xnodesystems.com/ It's capable of: 它能够:

(1) Multi-select; (1)多选; (2) Auto-complete; (2)自动完成; (3) Validation. (3)验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将多选列表发布到对象列表 asp.net core 2 - post multi-select list to list of objects asp.net core 2 ASP.NET MVC 5 中的多选 CheckBoxList - Multi-select CheckBoxList in ASP.NET MVC 5 Sitecore中的分类多选下拉列表 - Categorised multi-select dropdown list in Sitecore .Net MVC 5 多选列表框 - .Net MVC 5 Multi-Select List Box 如何使用c#枚举在ASP.Net MVC中创建一组多选复选框? - How do I make a group of multi-select checkboxes in ASP.Net MVC with c# enum? ASP.NET / C#-如何弹出带有列表框/多选控件的页面并将选定的ID发送回父页面 - ASP.NET / C# - How to pop up a page with a listbox / multi-select control and send the selected IDs back to the parent page 如何使用服务器端的复选框 asp.net 获取在 RadComboBox(多选下拉列表)中选择的所有值? - How to get all the values selected in a RadComboBox(multi-select drop-down) with check boxes on the server-side, asp.net? 样式ASP.net DropDownList不选择元素下拉列表 - Style ASP.net DropDownList Not Select Element DropDown List 根据asp.net中的下拉列表选择单选按钮 - Select radio buttons according to dropdown list in asp.net C#asp.net下拉列表选择值 - c# asp.net dropdown list select value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM