选中复选框后,EventHandler不会触发 [英] EventHandler not triggering when checkbox checked

查看:54
本文介绍了选中复选框后,EventHandler不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我选中复选框时,代码未到达事件处理程序。我通过给

一个断点证实了这一点。下面是我的代码:



When I check the checkbox, the code is not reaching the event handler. I verified this by giving
a break point. Hereunder is my code:

<asp:CheckBox ID="GuestChkBox" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" style=" margin-top:78px;margin-left:600px; font-size:larger"

 ></asp:CheckBox>







protected void CheckBox1_CheckedChanged(Object sender, EventArgs e)
    {
    }

推荐答案

尝试为CheckBox设置 AutoPostBack =true
Try to set AutoPostBack="true" for CheckBox.

< br>

确保AutoPostBack为True
make sure the AutoPostBack is True


试试这个东西



try this thing

<asp:CheckBox ID="GuestChkBox"  AutoPostBack="True"  runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" style=" margin-top:78px;margin-left:600px; font-size:larger"

 ></asp:CheckBox>


这篇关于选中复选框后,EventHandler不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆