ASP.NET中的多选下拉列表

是否有任何好的多选下拉列表与checkbox(webcontrol)存在的asp.net?

非常感谢

您可以使用System.Web.UI.WebControls.CheckBoxList控件或使用SelectionMode属性设置为MultipleSystem.Web.UI.WebControls.ListBox控件。

jQuery下拉列表可用于将常规多选html元素转换为下拉列表框,它可以在客户端上运行,因此可用于任何服务器端技术:

替代文字http://dropdown-check-list.googlecode.com/svn/trunk/doc/demo.png

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

我使用了http://dropdowncheckboxes.codeplex.com/上的开放源码控件,对此非常满意。; 我的补充是允许一个被选中的文件列表只使用文件名而不是完整的path,如果“select”标题变得太长。 我的添加在您的回发处理程序中被调用,而不是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不支持带checkbox的下拉列表。 你可以有一个下拉列表或一个checkbox列表。 你可能会使用javascript和隐藏div来伪造一个dropdowncheckbox列表,但是这不会仅仅是一个标准的checkbox列表。

当然有第三方控件看起来像一个下拉式checkbox列表,但他们正在使用div技巧。

您还可以使用双列表框,通过在两个列表之间来回移动项目来处理多重select。 即使总项目列表很长,这也具有一次很容易地查看所有选定项目的附加好处

(想象一下世界上每个城市的名单,只有第一个和最后一个select)

我喜欢Infragistics控件。 WebDropDown有你所需要的。 唯一的缺点是他们可能有点花哨。

这是一个很酷的ASP.NET Web控件,名为Multi-Select List Field,位于http://www.xnodesystems.com/ 。 它能够:

(1)多选; (2)自动完成; (3)validation。

Interesting Posts