Button event issue in asp.net [Resolved]

Posted by Programmer123 under ASP.NET on 9/13/2013 | Points: 10 | Views : 830 | Status : [Member] | Replies : 4
I am developing asp.net application. I have submit button and I have implemented btn_click(...) event in my page.
My problem is when I click on submit button, the btn_click(..) event is executed twice.
Can any one help me to solve this one.




Responses

Posted by: Allemahesh on: 9/16/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
One possible reason: Check your button declaration in your .aspx source. If you have a 'runat=server' and onclick="button1_click", and you have an event handler in your code-behind (ie. .aspx.vb), it will cause the event to be fired twice.
Here is an example in xxx.aspx:

<asp:Button id="button1" onclick="button1_Click" runat="server" Text="Click Me!"></asp:Button>


This declaration should be:

<asp:Button id="button1" runat="server" Text="Click Me!"></asp:Button>


Happy Coding.

If it helps you or directs U towards the solution, MARK IT AS ANSWER


Programmer123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/13/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
may be you are clicking for two times mistakenly
otherwise you might have two times code repeated for button click

http://www.vbforums.com/showthread.php?558520-RESOLVED-2005-Submit-button-click-event-firing-twice
http://forums.asp.net/t/1056418.aspx



Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Programmer123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 9/16/2013 [Member] Starter | Points: 25

Up
0
Down
HI,
try to verify your code you have written the code twice i thought if not
send your code we will verify it


Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Programmer123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prdpsvs on: 9/18/2013 [Member] Starter | Points: 25

Up
0
Down
Please send you code. It will be easier to point out what went wrong in your code.

Happy Coding.

Pradeep SVS
MCP

Programmer123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response