Reputation: 199
I have a checkedlistbox in asp.net web form page as :
<asp:CheckBoxList ID="TagListCheckBox" runat="server" Height="100px" Width = "300px"
style="z-index: 1; left: 63px; top: 146px; position: absolute; TextAlign="Left">
</asp:CheckBoxList>
and i add items to it dynamically :
protected void TagListButton_Click(object sender, EventArgs e)
{
string[] TagList;
TagList = LhClientClass.client.GetTagList();
foreach (string s in TagList)
{
TagListCheckBox.Items.Add(s);
}
}
But the height of the list box grows as the number of items being added grows.I want to restrict the number of items to be displayed and add a scroll button to it or something.How do I do it?
Upvotes: 1
Views: 719
Reputation: 44595
try to put a div around your control, this should do the trick:
<div style="width:200px; height:100px; overflow:auto;">
<asp:CheckBoxList ID="TagListCheckBox" runat="server" Width="300px"
style="z-index: 1; left: 63px; top: 146px; position: absolute; TextAlign="Left">
</asp:CheckBoxList>
</div>
Upvotes: 1