简体   繁体   English

ASP.Net Check Box Control是否在文件后面的代码中检查

[英]ASP.Net Check Box Control checked or not in code behind file

I am trying to use checkbox control in asp.net c# where I am facing an issue when I checked the checkbox and wants to display its text to the label control but it hasn't work. 我试图在asp.net c#中使用复选框控件,当我选中该复选框并想将其文本显示给标签控件时,我遇到了一个问题,但是它没有用。

Also I searched about it over google and here too but no use. 我也在谷歌和这里搜索过它,但是没有用。

Here is my code 这是我的代码

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox1.Checked == true)
            Label1.Text = "hello";
        else
            Label1.Text = "hi";
    }

Any help will be appreciated Please help me and Thanks in advance 任何帮助将不胜感激,请帮助我,并提前感谢

Make Sure that the AutoPostBack property of the CheckBox is set to true. 确保将CheckBox的AutoPostBack属性设置为true。 Also, this CheckBox might be inside an updatePanel and Label1 is not in an updatePanel. 另外,此CheckBox可能位于updatePanel内,而Label1不在updatePanel中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM