<div style="OVERFLOW-Y:scroll; WIDTH:120px; HEIGHT:50px">
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
Height="10px">
<asp:ListItem>ddd</asp:ListItem>
<asp:ListItem>ddd</asp:ListItem>
<asp:ListItem>d</asp:ListItem>
<asp:ListItem>fff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ff</asp:ListItem>
<asp:ListItem>ffffff</asp:ListItem>
</asp:CheckBoxList>
</div>
CheckBoxList控件本身无scroll bar, 另外它的height属性不起作用.
所以解决方法是在CheckBoxList控件外包一个有滚动条的<div>就 ok了。 -_-

本文介绍了解决ASP.NET中CheckBoxList控件因自身不带滚动条且高度属性无效的问题。通过在外层使用带有滚动条的div元素,可以有效地实现垂直滚动效果。
133

被折叠的 条评论
为什么被折叠?



