限制ASP.Net下拉列表中的项目数 [英] Limit the number of items in a ASP.Net drop down list
本文介绍了限制ASP.Net下拉列表中的项目数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我在应用程序中使用dropdownlist,我想限制项目数(即
20.)计数20后,应该提示达到最大限制
该怎么做
谢谢inAdvance
解决方案
一种可能性是,使用select元素的size属性指定可见项的数量.
< 选择 大小 =" > < 选项 > ; country1 < 选项 > country2 < 选项 > country3 < 选项 > country4 < 选项 > country5 < 选项 > country6 < 选项 > country7 < 选项 > country8 < 选项 > country9 < 选项 > country10 < /select > pre>
对数据源上的前20个项目使用take方法,然后将其绑定到组合框的数据源. http://www.dotnetperls.com/take [ 解决方案
one possibility is,Use the size attribute of the select element to specify the count of visible items.
<select size="5"> <option SELECTED />country1 <option />country2 <option />country3 <option />country4 <option />country5 <option />country6 <option />country7 <option />country8 <option />country9 <option />country10 </select>
use the take method for the first 20 items on your data source, then bind it to the datasource of the combobox.
http://www.dotnetperls.com/take[^]
这篇关于限制ASP.Net下拉列表中的项目数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文