button's click handler gets called twice

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
 
N

Nikhil Patel

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
 
M

Matt Hawley

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...
 
N

Nikhil Patel

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

Thanks...
 
M

Matt Hawley

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?
 
N

Nikhil Patel

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top