button's click handler gets called twice

  • Thread starter Thread starter Matt Hawley
  • Start date Start date
M

Matt Hawley

Do you have "AutoEventWireup" in your page directive set to true? If so, remove it or set it to false.

Matt Hawley, MCAD .NET
http://www.eworldui.net

Hi all,
I have a strange problem. I have a button called btnSubmit on a .aspx
page. I have written btnSubmit_Click method in C# to handle the button's
click event. In the .aspx file, the onclick attribute is set as
onclick="btnSubmit_Click". This is the only place where I call the
btnSubmit_Click event handler. But when I run the application and click the
btnSubmit button, the btnSubmit_Click method get called twice.
Any idea?

Thanks...
-Nikhil
 
Hi all,
I have a strange problem. I have a button called btnSubmit on a .aspx
page. I have written btnSubmit_Click method in C# to handle the button's
click event. In the .aspx file, the onclick attribute is set as
onclick="btnSubmit_Click". This is the only place where I call the
btnSubmit_Click event handler. But when I run the application and click the
btnSubmit button, the btnSubmit_Click method get called twice.
Any idea?

Thanks...
-Nikhil
 
Nikhil,

Hmm, You stated that you have the OnClick set in HTML...if you view your C#/VB.NET code, is there also another wireup somewhere?

Matt Hawley, MCAD .NET
http://www.eworldui.net

Hi Matt,
AutoEventWireup is already set to false. Is there anything else I can
try?

Thanks...
 
Hi Matt,
AutoEventWireup is already set to false. Is there anything else I can
try?

Thanks...
 
Awesome, glad I could help!

Matt Hawley, MCAD .NET
http://www.eworldui.net

Yes, I had another wireup in the code behind file. After I removed it, the
application worked fine.
Thanks...
-Nikhil

Matt Hawley said:
Nikhil,

Hmm, You stated that you have the OnClick set in HTML...if you view your
C#/VB.NET code, is there also another wireup somewhere?
 
Yes, I had another wireup in the code behind file. After I removed it, the
application worked fine.
Thanks...
-Nikhil

Matt Hawley said:
Nikhil,

Hmm, You stated that you have the OnClick set in HTML...if you view your
C#/VB.NET code, is there also another wireup somewhere?
 
Back
Top