asp.net Button OnClick event not firing

前端 未结 15 1639
闹比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:03

    Add validation groups for your validator elements. This allows you distinguish between different groups which to include in validation. Add validation group also to your submit button

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

    If the asp button is inside <a href="#"> </a> tag then also the Click event will not raise.

    Hope it's useful to some one.

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

    Try to go into Design mode in Visual Studio, locate the button and double click the button that should setup the event. Otherwise once the button is selected in Design more, go to the properties and try setting it from there.

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

    If it's throwing no error but still not firing the click event when you click the submit button, try to add action="YourPage.aspx" to your form.

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

    In the case of nesting the LinkButton within a Repeater you must using something similar to the following:

    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="MyUpdate">LinkButton</asp:LinkButton>
    
     protected void Repeater1_OnItemCommand(object source, RepeaterCommandEventArgs e)
     {
        if (e.CommandName.Equals("MyUpdate"))
        {
            // some code
        }
     }
    
    0 讨论(0)
  • 2020-11-30 06:10

    i had the same problem did all changed the button and all above mentioned methods then I did a simple thing I was using two forms on a single page and form with in the form so I removed one and it worked :)

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