Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir,
In this project I'm facing a problem. In this page the I couldn't reached at the button click event. The breakpoints hits at the page load, but not working any of the buttons and so code has not executed at the run time.
In the Design Part:

VB
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
          CssClass="btn" onclick="btnSubmit_Click1" />
          <asp:Button
          ID="btnCancel" runat="server" Text="Cancel" CssClass="button"
          onclick="btnCancel_Click" />


In the Code Part:

C#
protected void Page_Load(object sender, EventArgs e)
    {
       // lblMsg.Text = "Data submitted successfully...";
    }


C#
protected void btnSubmit_Click1(object sender, EventArgs e)
   {
       lblMsg.Text = "Data inserted successfully...";
   }
   protected void btnCancel_Click(object sender, EventArgs e)
   {
       resetText();
   }




I found that the error is in my Master Page. When I add a new page excluding Master Page all the thing are worked fine and when I add it through Master page then button click event does not fire, So what is the error in Master Page I could not found.
Posted
Updated 19-Apr-15 1:17am
v3
Comments
Afzaal Ahmad Zeeshan 19-Apr-15 4:31am    
Breakpoints are hit when control reaches a line in your code. How do you call these events?
Kornfeld Eliyahu Peter 19-Apr-15 4:41am    
The code - as you posted it - does not indicate any problem...You may have something around that code (like UpdatPanels) that prevent the event handler to be called...Or there is some code that finishes the response before it comes to the event-handling part (Response.End somewhere?)...

 
Share this answer
 
Comments
bigyan sahoo 19-Apr-15 7:15am    
I found that the error is in my Master Page. When I add a new page excluding Master Page all the thing are worked fine and when I add it through Master page then button click event does not fire, So what is the error in Master Page I could not found.
I have solved it. Actually there are two form tag in my Master page, so the code does not work perfectly. Now it works correctly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900