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?
I added the OnClick event to my code. But I still face that problem.
All the previous answers are correct, except that you "already added" the OnClick event to the ".aspx" file. I don't know whether it is something in the template you're using, or somewhere else in the code. But I would recommend that you check the following (Based on my experience in being stuck in similar situations):
Some points you may try... The code that you posted (after update) should work.
Breakpoints
not label or any other markup change, but if you want it ... you should check if the Title
component has runat="server"
attribute and it's within an update panel. If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With