How to show ScrollBar in a CheckBoxList in asp.net

asp.net checkboxlist scrollbar
checkboxlist-scrollbar.aspx

<%@ Page Language="C#" AutoEventWireup="true"%>    
      
<!DOCTYPE html>
        
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    { 
        if(!Page.IsPostBack)
        {
            string[] birds = { 
                                 "Ribbon-tailed Astrapia",
                                 "Superb Bird of Paradise",
                                 "Paradise Riflebird",
                                 "King Bird of Paradise",
                                 "Jacky Winter",
                                 "Hypocolius",
                                 "Cedar Waxwing",
                                 "Black-capped Chickadee"
                             };

            CheckBoxList1.DataSource = birds;
            CheckBoxList1.DataBind();
        }
    }
</script>        
        
<html xmlns="http://www.w3.org/1999/xhtml">        
<head id="Head1" runat="server">        
    <title>asp.net checkboxlist scrollbar</title>
    <style type="text/css">
        .block {
            height:150px;
            width:200px;
            border:1px solid aliceblue;
            overflow-y:scroll;
        }
    </style>
</head>        
<body>        
    <form id="form1" runat="server">        
    <div>        
        <h2 style="color:MidnightBlue; font-style:italic;">        
            asp.net example - checkboxlist scrollbar
        </h2>        
        <hr width="550" align="left" color="Gainsboro" />        
        <br /><br />
        <div class="block">
            <asp:CheckBoxList 
                ID="CheckBoxList1"
                runat="server"
                RepeatLayout="Table"
                >
            </asp:CheckBoxList>  
        </div>
    </div>        
    </form>        
</body>        
</html>
More asp.net examples