asp.net Button OnClick event not firing

前端 未结 15 1641
闹比i
闹比i 2020-11-30 05:43

I have problem in asp.net button control.

I define a button in form, onclick event of button is not firing when I click on the button.

&         


        
相关标签:
15条回答
  • 2020-11-30 06:11

    I had a similar issue and none of the answers worked for me. Maybe someone finds my solution helpful. In case you do not mind submitting on button click, only attaching to click event setting UseSubmitBehavior="false" may be worth trying.

    0 讨论(0)
  • 2020-11-30 06:12

    Have you copied this method from other page/application ? if yes then it will not work, So you need to delete the event and event name assigned to the button then go to design and go to button even properties go to onClick event double click next to it, it will generate event and it automatically assigns event name to the button. this should work

    0 讨论(0)
  • 2020-11-30 06:13

    Because your button is in control it could be that there is a validation from another control that don't allow the button to submit. The result in my case was to add CausesValidation property to the button:

    <asp:Button ID="btn_QuaSave" runat="server" Text="SAVE" OnClick="btn_QuaSave_Click" CausesValidation="False"/> 
    
    0 讨论(0)
  • 2020-11-30 06:13

    Even i had two forms one for desktop view and other for mobile view , Removed one formed worked for me . I dint knew asp.page should have only one form.

    0 讨论(0)
  • 2020-11-30 06:14

    In my case I put required="required" inside CKEditor control.
    Removing this attribute fixed the issue.
    Before

    <CKEditor:CKEditorControl ID="txtDescription" BasePath="/ckeditor/" runat="server" required="required"></CKEditor:CKEditorControl>
    

    After

    <CKEditor:CKEditorControl ID="txtDescription" BasePath="/ckeditor/" runat="server"></CKEditor:CKEditorControl>
    
    0 讨论(0)
  • 2020-11-30 06:17

    Try to Clean your solution and then try once again.

    It will definitely work. Because every thing in code seems to be ok.

    Go through this link for cleaning solution>

    http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/e53aab69-75b9-434a-bde3-74ca0865c165/

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