Reputation: 2982
I have a asp.net page where I have a button:
<td align="center"><asp:Button runat="server" ID="btnCertify" Text="Certify"
OnClick="btnCertify_Onclick"/></td>
and when I click on btnCertify, the breakpoint set on PageLoad is triggered, not the breakpoint on protected void btnCertify_Onclick(object sender, EventArgs e)
How can I get the code to stop calling pageload event when btnCertify is clicked?
Upvotes: 1
Views: 9941
Reputation: 17324
You have to add this to your Page_Load()
event so that not all of the code executes if it is only a post-back.
if (!IsPostBack){
//Your page load code here...
}
Upvotes: 3