How to change Checbox text style in ASP.Net C#

In this ASP.Net tutorial we will learn to change the Checkbox text style programmatically in ASP.Net with C#.

STEP 1 – Design ASP.Net web form with one CheckBox control along with Two Button Control:

<table border=”1″ bordercolor=”#000000″ style=”z-index: 100; left: 272px; position: absolute;
top: 72px”>
<tr>
<td colspan=”3″ style=”width: 582px; height: 100px;”>
<asp:Image ID=”Image1″ runat=”server” ImageUrl=”https://meeraacademy.com/wp-content/themes/elemin/uploads/logo/meeralogo.gif” /></td>
</tr>
<tr>
<td colspan=”3″ rowspan=”2″ style=”width: 582px; height: 21px; text-align: center”>
<table style=”width: 464px”>
<tr>
<td colspan=”1″ style=”width: 257px; height: 24px”>
<strong><span style=”font-size: 14pt; color: #6600cc; font-family: Arial”>Change CheckBox Font Style Programmatically</span></strong></td>
</tr>
<tr>
<td style=”width: 257px; height: 14px;”>
&nbsp;
</td>
</tr>
<tr>
<td style=”width: 257px; height: 22px; text-align: center;”>
&nbsp;<asp:CheckBox ID=”CheckBox1″ runat=”server” Text=”CheckBox Font Style” Font-Bold=”True” /></td>
</tr>
<tr>
<td style=”width: 257px”><asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click” Text=”Change Style” Font-Bold=”True” /><asp:Button ID=”Button2″ runat=”server” OnClick=”Button2_Click” Text=”Original Style” Font-Bold=”True” /></td>
</tr>
<tr>
<td style=”width: 257px; text-align: center”>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
</table>

The ASP.Net Checkbox Example output is :

Change Text Style of CheckBox in ASP.Net with C#
Change Text Style of CheckBox in ASP.Net with C#

STEP 2 – write the below code on code file of ASP.Net application :

    protected void Button1_Click(object sender, EventArgs e)
{
CheckBox1.Font.Italic = true;
CheckBox1.Font.Underline = true;
CheckBox1.Font.Bold = false;
}

protected void Button2_Click(object sender, EventArgs e)
{
CheckBox1.Font.Italic = false;
CheckBox1.Font.Underline = false;
CheckBox1.Font.Bold = true;
}

The ASP.Net Checkbox Example output is :

Change Text Style of CheckBox in ASP.Net with C#
Change Text Style of CheckBox in ASP.Net with C#

The ASP.Net Checkbox Example output is :

Change Text Style of CheckBox in ASP.Net with C#
Change Text Style of CheckBox in ASP.Net with C#

I hope this CheckBox control ASP.Net Example will help you……..

Leave a Reply

Your email address will not be published. Required fields are marked *