CheckBoxList CssClass
CheckBoxList have lots of built in property to set change it's design. But if you want to more customize the
design then you need to take help from core CSS design. In this example we present how can you apply basic
CSS class in an ASP.NET CheckBoxList control.
Here we applied font family, text color, font style, font weight and font size CSS to CheckBoxList. Click the button and see the change made in CheckBoxList.
Here we applied font family, text color, font style, font weight and font size CSS to CheckBoxList. Click the button and see the change made in CheckBoxList.
CheckBoxListCssClass.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
CheckBoxList1.CssClass = "CheckBoxListCssClass";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to use CheckBoxList CssClass in asp.net</title>
<style type="text/css">
.CheckBoxListCssClass
{
font-family:Courier New;
color:OrangeRed;
font-style:italic;
font-weight:bold;
font-size:large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:SaddleBrown; font-style:italic;">
How to use CheckBoxList
<br /> CssClass in asp.net
</h2>
<hr width="275" align="left" color="DimGray" />
<asp:Label
ID="Label1"
runat="server"
>
</asp:Label>
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
>
<asp:ListItem Text="SpringGreen"></asp:ListItem>
<asp:ListItem Text="Whaet"></asp:ListItem>
<asp:ListItem Text="White"></asp:ListItem>
<asp:ListItem Text="PaleVioletRed"></asp:ListItem>
<asp:ListItem Text="OrangeRed"></asp:ListItem>
</asp:CheckBoxList>
<br />
<asp:Button
ID="Button1"
runat="server"
OnClick="Button1_Click"
Text="Apply CheckBoxList CssClass"
Height="45"
Font-Bold="true"
ForeColor="DodgerBlue"
/>
</div>
</form>
</body>
</html>

