473,421 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

In asp event occurs once for textbox.textchanged AND button.button

I have a textbox and a button on my asp.net form. I have some Smtp code in my
button click procedure. When the user hits the return for the textbox the
button procedure runs. When the button is clicked the button procedure also
runs. This fine so I get the Smtp code to run either way. The problem is that
the user sometimes hits return AND clicks the "submit" button so the Smtp
code gets executed twice. Should I use Application state and a boolean to
make sure that the Smtp code only runs once?

I tried the various events and assigning them to each of the the textbox
changed and button click, but I could find the correct combination. Even if
no event is assigned to the textchanged or button click the code Smtp code
runs when the two events occur so I don't know the easy way around this. Help!

Thanks
--
Spencer
Nov 19 '05 #1
1 1990
Maybe disable the button on post back to that method?

Jason Lind

"Spencer H. Prue" wrote:
I have a textbox and a button on my asp.net form. I have some Smtp code in my
button click procedure. When the user hits the return for the textbox the
button procedure runs. When the button is clicked the button procedure also
runs. This fine so I get the Smtp code to run either way. The problem is that
the user sometimes hits return AND clicks the "submit" button so the Smtp
code gets executed twice. Should I use Application state and a boolean to
make sure that the Smtp code only runs once?

I tried the various events and assigning them to each of the the textbox
changed and button click, but I could find the correct combination. Even if
no event is assigned to the textchanged or button click the code Smtp code
runs when the two events occur so I don't know the easy way around this. Help!

Thanks
--
Spencer

Nov 19 '05 #2

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

Similar topics

8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
3
by: tfs | last post by:
I have a small page I am using to play around with events and am confused why the "onTextChanged" event doesn't fire until I press the button? I am trying to allow the user to put something in...
2
by: Owin | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on. When...
4
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
1
by: Samuel Chan | last post by:
I used the textchanged event of textbox and set the autopostback property to true. The textchanged event should fire when the content of the textbox is changed and user tab out of the textbox...
3
by: vvenk | last post by:
Hello: I came across the following code in C# that adds a custom event handler for triggering the click event on a button: System.Web.UI.WebControls.Button button; object buttonOnTab1 =...
3
by: Robert W. | last post by:
I'm new to ASP.net programming so excuse my ignorance if the following question seems overly simplistic. I've created a simple Login form with 3 primary WebControls: - A TextBox for the Username...
5
by: S_K | last post by:
This is a weird problem.. I have a page with a textbox and a button (along with a bunch of other stuff). Both the textbox and the button have their SEPERATE events defined for the textchanged...
1
by: nupuragr82 | last post by:
I have a parent form and on button click I am calling a child page where i have a textbox and a button. On button click of child form I am passing the value of the Textbox to the Textbox in parent...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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
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
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
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...

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.