如何限制html.dropdownlist中显示的项目数量?
我的网页上有一个 html.dropdownlist
,如下所示:
<%=Html.DropDownList("MyDropDown", Model.Data, new { @class = "dropdown"})%>
我正在用大约 80 个项目填充下拉列表。
问题是,当我单击下拉菜单时,项目列表将从屏幕顶部呈现到屏幕底部。
如何设置下拉列表,使其在单击下拉菜单时最多只显示 20 个项目(即用户需要向下滚动才能看到第 21 - 80 项)?
我预计(!)会有一个 html.dropdownlist
属性来控制显示项目的数量,这将允许类似以下内容的操作,例如:
<% =Html.DropDownList("MyDropDown", Model.Data, new { @class = "dropdown", rows ="20"}) %>
从我在 msdn 网站上所做的研究来看,它似乎没有这样的属性,并且每个浏览器都有自己的下拉列表中显示多少项的规则(?)。
我使用的是IE6和IE7。
I have a html.dropdownlist
on my webpage as follows:
<%=Html.DropDownList("MyDropDown", Model.Data, new { @class = "dropdown"})%>
I am populating the dropdown with ~80 items.
The issue is that when I click the dropdown the list of items is rendered from the top of the screen to the bottom of the screen.
How can I set up the dropdownlist so that it only displays a maximum of 20 items when the dropdown menu is clicked (i.e. user needs to scroll down to see items 21 - 80)?
I was anticipating (!) that there would be a html.dropdownlist
property to control the number of displayed items that would allow something like the following e.g.:
<% =Html.DropDownList("MyDropDown", Model.Data, new { @class = "dropdown", rows ="20"}) %>
From research I have been doing on the msdn website it appears that there is no such property and that each browser has its own rules of how many items are displayed in a dropdownlist (?).
I am using IE6 and IE7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FlexBox 允许您“分页”行。
FlexBox allows you to "page" the rows.