CheckBox Event Program

CheckBox Event:
write code on checkBox1,checkBox2 and checkBox3



CODE:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Styles_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox1.Checked == true)
        {
            TextBox1.Text = "Red";
            
        }
        else
        {
            TextBox1.Text = "";
        }
    }
    protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox2.Checked == true)
        {
            TextBox1.Text = "blue";
        }
        else
        {
            TextBox1.Text = "";
        }
    }
    protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox3.Checked == true)
        {
            TextBox1.Text = "yellow";
        }
        else
        {
            TextBox1.Text = "";
        }
    }

}

output

Popular Posts