473,651 Members | 2,987 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="btnSub mit_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 5458
Do you have "AutoEventWireu p" 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="btnSub mit_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.integrity ts.com> wrote in message
news:OB******** ******@TK2MSFTN GP12.phx.gbl...
Do you have "AutoEventWireu p" 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="btnSub mit_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.integrity ts.com> wrote in message
news:OB******** ******@TK2MSFTN GP12.phx.gbl...
Do you have "AutoEventWireu p" 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="btnSub mit_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.integrity ts.com> wrote in message
news:OA******** ******@TK2MSFTN GP09.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.integrity ts.com> wrote in message
news:OB******** ******@TK2MSFTN GP12.phx.gbl...
> Do you have "AutoEventWireu p" 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="btnSub mit_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.integrity ts.com> wrote in message
news:OA******** ******@TK2MSFTN GP09.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.integrity ts.com> wrote in message
news:OB******** ******@TK2MSFTN GP12.phx.gbl...
Do you have "AutoEventWireu p" 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="btnSub mit_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
5134
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 way I'd anticipate), but the FlatStyle.System one does not. If you click on any of the buttons, use the enter key, or the spacebar, they will bring up a messagebox that says "Activate". Except the FlatStyle.System one, which will bring up _two_...
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 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...
11
6956
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 that does some simple processing, followed by a response.redirect. When the user clicks on this button, I would like the button to
1
1717
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 text boxes bool blnEmpty = false; string strQuantity;
3
8786
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 twice, once with postback true, and second time without postback. This only happens for this button. How can I sort out this issue, any clues what to look for to get this sorted please. <p>Search Bookmarks: <asp:TextBox ID="txtSearch"...
0
1549
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 frustration, the eventhandler does not get executed everytime I click the button. I have to click the button twice at times to make sure that the event handler is being called. Why is the control behaving in this way? This problem is not specific for a...
2
2932
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 eventArgs As System.EventArgs) Handles cmdRenew.Click Try If x Is Nothing Then
9
4732
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 day. It worked wonderfully, but it was in C# So I converted it to VB with http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx It got upset about private and so I changed those to protected
9
2740
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 affecting this. But I'm stuck. My handler is in C# code and the code looks right. But absolutely nothing happens when I click the button. protected void Button1_Click(object sender, EventArgs e)
0
8361
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8584
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5615
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2701
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 we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.