简体   繁体   中英

Check Box Event onCheckChanged : Event is not firing

I am using a CheckBox like this:

ASPX

<asp:CheckBox ID="cbCode" runat="server" OnCheckedChanged="cbCode_CheckedChanged" />

C#

protected void cbCode_CheckedChanged(object sender, EventArgs e)
{
    if (!Convert.ToBoolean(cbCode.Checked))
    {

    }
    else
    {

    }
}

The event is not firing and I'm unable to find out what is missing.

您需要在复选框上使用AutoPostBack="True"

您可以在updatepanel的内容下方为复选框选中更改添加触发器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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