ASP.NET: Change CheckBox Text in code file

How to change control text in code file

If you want to change text of the control in code file then you must use text property of the control in code file. Simple you can say

ControlId.Text = " Assign Text in double quotes";
 lets take a simple example to change CheckBox text , alignment of the text and color of the Text.
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
        CheckBox1.Text = "change text of the control";
        CheckBox1.TextAlign = TextAlign.Left;
        CheckBox1.ForeColor = System.Drawing.Color.Green;

<html xmlns="">
<head runat="server">
    <title>Change CheckBox Text in Code file</title>
    <form id="form1" runat="server">
    <asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox Text Change" />
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Change Text"
        Width="85px" />

ASP.NET: Change CheckBox Text in code file

ASP.NET: Change CheckBox Text in code file


Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites