How to change CheckBox Border Style Programmatically in ASP.Net C#

In this ASP.Net tutorial, How to change Checkbox control Border Style Programmatically in ASP.Net with C#.

STEP 1 – Design the CheckBox control Example web page like:

<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=”http://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: 496px”>
<tr>
<td colspan=”1″ style=”width: 274px; height: 24px”>
<strong><span style=”font-size: 14pt; color: #6600cc; font-family: Arial”>Change CheckBox
Border Style Programmatically&nbsp;</span></strong></td>
</tr>
<tr>
<td style=”width: 274px; height: 8px;”>
&nbsp;
</td>
</tr>
<tr>
<td style=”width: 274px; height: 22px; text-align: center;”>
&nbsp;<asp:CheckBox ID=”CheckBox1″ runat=”server” Text=”CheckBox Font Style” Font-Bold=”True” BorderStyle=”Solid” BorderWidth=”2px” /></td>
</tr>
<tr>
<td style=”width: 274px”><asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click” Text=”Dotted Border Style” Font-Bold=”True” />
<asp:Button ID=”Button2″ runat=”server” OnClick=”Button2_Click” Text=”Solid Border Style” Font-Bold=”True” />&nbsp;</td>
</tr>
<tr>
<td style=”width: 274px; text-align: center”>
<asp:Label ID=”lblanswer” runat=”server” Font-Bold=”True” ForeColor=”Maroon”></asp:Label>&nbsp;&nbsp;
&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
</table>

- The ASP.Net Checkbox Example output is :

CheckBox control Border Style in ASP.Net with C#

CheckBox control Border Style in ASP.Net with C#

STEP 2 – Write below code at ASP.Net code page:

protected void Button1_Click(object sender, EventArgs e)
{
CheckBox1.BorderStyle = BorderStyle.Dotted;
}

protected void Button2_Click(object sender, EventArgs e)
{
CheckBox1.BorderStyle = BorderStyle.Solid;
}

The ASP.Net Checkbox Example output is :

CheckBox control Border Style in ASP.Net with C#

CheckBox control Border Style in ASP.Net with C#

The ASP.Net Checkbox Example output is :

CheckBox control Border Style in ASP.Net with C#

CheckBox control Border Style in ASP.Net with C#

I hope Change Border Style of Checkbox control ASP.Net Example will help you……..

Leave a Reply

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

2 + 3 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">