473,503 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

button's click handler gets called twice

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
Nov 18 '05 #1
5 5440
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

Nov 18 '05 #2
Hi Matt,
AutoEventWireup is already set to false. Is there anything else I can
try?

Thanks...

"Matt Hawley" <mhawley@n!o!s!p!a!m.integrityts.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
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

Nov 18 '05 #3
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...

"Matt Hawley" <mhawley@n!o!s!p!a!m.integrityts.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
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


Nov 18 '05 #4
Yes, I had another wireup in the code behind file. After I removed it, the
application worked fine.
Thanks...
-Nikhil

"Matt Hawley" <mhawley@n!o!s!p!a!m.integrityts.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
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...

"Matt Hawley" <mhawley@n!o!s!p!a!m.integrityts.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
> 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
>
>
>


Nov 18 '05 #5
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" <mhawley@n!o!s!p!a!m.integrityts.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
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...

"Matt Hawley" <mhawley@n!o!s!p!a!m.integrityts.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
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



Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5121
by: Jason Kyle Baginski | last post by:
Here's a little test app to demonstrate a problem I'm having. It creates four buttons, each one with the different FlatStyle types available. Three of them behave exactly the same way(and the...
5
324
by: Nikhil Patel | last post by:
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...
11
6933
by: Dot net work | last post by:
Hello. I've read many posts about disabling submit buttons, but I can't get these answers to solve my problem. I have a server side asp.net button, and under the button I have code behind...
1
1711
by: mike parr | last post by:
I have an button which calls its Click procedure twice when clicked. This is my code : public void btnAddToCartPersonal_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //validate...
3
8705
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
0
1542
by: Diffident | last post by:
Hello All, I have an asp:button and I have tied an eventhandler to this button's click event which means that the eventhandler should be executed everytime I click the button. But to my...
2
2921
by: jburkle | last post by:
The following is the onclick method called when the "Renew" button is clicked by the user in my Windows application: ..... Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal...
9
4722
by: mosscliffe | last post by:
I am sorry but I am all very new and slow at understanding all this ASP.NET2. I found some code which showed how to page with a repeater. All very excited as I had been looking for this all...
9
2725
by: Jonathan Wood | last post by:
Does anyone know of any reason a button on a master page would have no effect? I have a complex HTML page that I'm converting to ASP.NET, and acknowledge I could have something odd that is...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.