CheckedChanged event is not fired

后端 未结 1 908
南方客
南方客 2021-01-12 18:07

In my WebForm I want the total price changed when the user check one product but I have this problem with my code ,

the CheckedChanged eve

相关标签:
1条回答
  • 2021-01-12 18:57

    All ASP.NET Server controls except Button, Hyperlink and LinkButton have a default AutoPostBack property of false, So you should set AutoPostBack="true" in your CheckBox:

    <asp:CheckBox ID="ckb1" runat="server" AutoPostBack="true" OnCheckedChanged="ckb1_CheckedChanged" />
    

    It is firing only when I click the button

    As I said this is because the Button have AutoPostBack property of true by default so after you checked the CheckBox and then click the button the CheckBox state automatically posts back to the server.

    0 讨论(0)
提交回复
热议问题