ASP.NET button not firing on click event

Viewed 76944

I am new to Asp.net and my question may not be so professional. I am using the design of Udemy.com in my asp.net web forms project. I put the header and footer of udemy in a masterpage. But when I add a button to one of m web forms the click event will not fire.

<asp:Button ID="Button1" runat="server" onclick="Button1_Click1" Text="Button" />

protected void Button1_Click1(object sender, EventArgs e)
{
    Page.Title = "Sample Text";
}

To fix this problem, I deleted all of the scripts from my pages. Also I tried to set CausesValidation to False. But nothing helps. Could you help me fix this problem?

Update

I added the OnClick event to my code. But I still face that problem.

19 Answers

If the problem is validation firing and your button shouldn't trigger validation, consider adding CausesValidation="false" to the attributes of your button.

Related