I have an asp.net page in which I'm making an addition that requires me to add another button event. In the example below, btnTwo and btnThree fire their OnClick() events and function as they should. Yet when I added btnOne with its associated OnClick() event, it dose not fire the break point I setup for String test. I inspected the page while running the project and noticed that btnTwo and btnThree have an onclick dopostbackwithoptions in the control yet btnOne dose not. Also when clicking btnOne, pageload events do not fire as well. I don't know whats going on with this or what I am doing wrong. Ive also tried doing a clean build on the solution as that was recommended by another online resource but it still dose not function as it should.
Page:
<table style="width: 210px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 50px">
<asp:Button ID="btnOne" runat="server" CssClass="DefaultButton" Width="120px" OnClick="btnOne_Click" />
</td>
<td style="padding-right: 50px">
<asp:Button ID="btnTwo" runat="server" ValidationGroup="QtyGroup" CssClass="DefaultButton" Width="90px" OnClick="btnTwo_click" />
</td>
<td>
<asp:Button ID="btnThree" runat="server" CssClass="DefaultButton" Width="90px" OnClick="btnThree_click" />
</td>
</tr>
</table>
CodeBehind:
protected void btnOne_Click(object sender, EventArgs e)
{
string test = "";
}
I am willing to bet your button event is firing, but your debugging is not firing. I have seen this when binding the solution to iis incorrectly. In your event, add some code to update a label and I bet it works. Check your URL. I have seen when my IIS binding is incorrect the url changes from localhost:someport to a dns name. This may cause your debugging break points not to fire.
Restart VS and then delete the event name from .aspx page and again create a new event . Some times VS has some problems. It has worked for me sometimes.
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