[英]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();
}
Check this out. 看一下这个。 It's free one. 它是免费的。
http://irfaann.blogspot.com/2009/07/ajax-based-multiselect-dropdown-control.html http://irfaann.blogspot.com/2009/07/ajax-based-multiselect-dropdown-control.html
HTH, HTH,
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.