Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Scroll for checkboxlist in Asp.net code behind?

Tags:

asp.net

I have tried the following code but its not working. please help me for finding the solution.

Source Code:

CheckBoxList chklstProducts = new CheckBoxList();
chklstProducts.DataSource = lstProduct;
chklstProducts.ID = "chklstProducts" + (i + 1);
chklstProducts.DataValueField = "ProductID";
chklstProducts.DataTextField = "ProductName";
chklstProducts.DataBind();
cell6.Height = 20;

Thanks in advance

like image 247
Boopathi.Indotnet Avatar asked Sep 02 '26 03:09

Boopathi.Indotnet


2 Answers

You need to use CSS to achieve the vertical scroll with checkboxlist. You just need to wrap your list inside this div

<div style="width:200px; height:300px; overflow-y:auto">
// Checkbox List
</div>
like image 131
Sachin Avatar answered Sep 03 '26 17:09

Sachin


By default scroll won't work. You may need to add your checkboxlist control inside a div

<div style="height:100px;overflow:auto;"> <asp:CheckBoxList></asp:CheckBoxList> </div> 
like image 32
Deepu Madhusoodanan Avatar answered Sep 03 '26 18:09

Deepu Madhusoodanan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!