In this ASP.Net tutorials we will learn to change the Checkbox text programmatically in ASP.Net C# with an Example.
STEP 1 – Design the ASP.Net web page with One CheckBox control, One Button Control and One Label 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; text-align: center;”>
<strong><span style=”font-size: 14pt; color: #6600cc; font-family: Arial”>Change CheckBox Text Programmatically</span></strong></td>
</tr>
<tr>
<td style=”width: 257px; height: 24px;”>
</td>
</tr>
<tr>
<td style=”width: 257px; height: 22px; text-align: center;”>
<asp:CheckBox ID=”CheckBox1″ runat=”server” Text=”CheckBox HI” Font-Bold=”True” /></td>
</tr>
<tr>
<td style=”width: 257px; height: 26px;”><asp:Button ID=”btnchangetext” runat=”server” OnClick=”btnchangetext_Click” Text=”Chage Text” Font-Bold=”True” /></td>
</tr>
<tr>
<td style=”width: 257px; text-align: center”>
<asp:Label ID=”lblanswer” runat=”server”></asp:Label></td>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
</table>
The ASP.Net Checkbox Example output is :
STEP 2 – write below code at ASP.Net code page on Button Click Event:
protected void btnchangetext_Click(object sender, EventArgs e)
{
CheckBox1.Text = “HELLO”;
lblanswer.Text=”CheckBox Text Changed”;
}
The ASP.Net Checkbox Control Example output is :
– I hope this ASP.Net tutorials of Change Text of CheckBox Control will help you…..