473,419 Members | 1,925 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,419 software developers and data experts.

Why is a button Click event also called when a textbox TextChanged event is called???

S_K
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 and click events. When I change the text
in the textbox the textchanged event is called as expected. But the
button click event is also called!?

Whats with that?!

Can anybody help? This is driving me crazy!

Thanks

Steve

Nov 7 '07 #1
5 5223
possible reasons

1) you hit enter/return after changing the text. this will cause the
button to postback

2) you don't have autopostback set on the textbox, so the postback only
occurs when you hit the button.

-- bruce (sqlwork.com)
S_K wrote:
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 and click events. When I change the text
in the textbox the textchanged event is called as expected. But the
button click event is also called!?

Whats with that?!

Can anybody help? This is driving me crazy!

Thanks

Steve
Nov 7 '07 #2
S_K
On Nov 7, 1:41 pm, bruce barker <nos...@nospam.comwrote:
possible reasons

1) you hit enter/return after changing the text. this will cause the
button to postback

2) you don't have autopostback set on the textbox, so the postback only
occurs when you hit the button.

-- bruce (sqlwork.com)

S_K wrote:
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 and click events. When I change the text
in the textbox the textchanged event is called as expected. But the
button click event is also called!?
Whats with that?!
Can anybody help? This is driving me crazy!
Thanks
Steve- Hide quoted text -

- Show quoted text -
First, Thanks for responding.

Second, The first possiblility makes sense. However, why would hitting
the <ENTor return key cause a button event to fire? Is there any way
I can undo that?

Thanks again.
Steve

Nov 7 '07 #3
LVP
http://www.arraystudio.com/as-worksh...-keypress.html
"S_K" <st***********@yahoo.comwrote in message
news:11**********************@d55g2000hsg.googlegr oups.com...
On Nov 7, 1:41 pm, bruce barker <nos...@nospam.comwrote:
>possible reasons

1) you hit enter/return after changing the text. this will cause the
button to postback

2) you don't have autopostback set on the textbox, so the postback only
occurs when you hit the button.

-- bruce (sqlwork.com)

S_K wrote:
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 and click events. When I change the text
in the textbox the textchanged event is called as expected. But the
button click event is also called!?
Whats with that?!
Can anybody help? This is driving me crazy!
Thanks
Steve- Hide quoted text -

- Show quoted text -

First, Thanks for responding.

Second, The first possiblility makes sense. However, why would hitting
the <ENTor return key cause a button event to fire? Is there any way
I can undo that?

Thanks again.
Steve

Nov 7 '07 #4
LVP
http://www.felgall.com/jstip43.htm
"S_K" <st***********@yahoo.comwrote in message
news:11**********************@d55g2000hsg.googlegr oups.com...
On Nov 7, 1:41 pm, bruce barker <nos...@nospam.comwrote:
>possible reasons

1) you hit enter/return after changing the text. this will cause the
button to postback

2) you don't have autopostback set on the textbox, so the postback only
occurs when you hit the button.

-- bruce (sqlwork.com)

S_K wrote:
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 and click events. When I change the text
in the textbox the textchanged event is called as expected. But the
button click event is also called!?
Whats with that?!
Can anybody help? This is driving me crazy!
Thanks
Steve- Hide quoted text -

- Show quoted text -

First, Thanks for responding.

Second, The first possiblility makes sense. However, why would hitting
the <ENTor return key cause a button event to fire? Is there any way
I can undo that?

Thanks again.
Steve

Nov 7 '07 #5
"S_K" <st***********@yahoo.comwrote in message
news:11**********************@d55g2000hsg.googlegr oups.com...
On Nov 7, 1:41 pm, bruce barker <nos...@nospam.comwrote:
>possible reasons

1) you hit enter/return after changing the text. this will cause the
button to postback
<...>
Second, The first possiblility makes sense. However, why would hitting
the <ENTor return key cause a button event to fire? Is there any way
I can undo that?
If you are using .NET 2.0, you can set the Button's UseSubmmitBehavior
property to false.

--
Robert Dunlop
----------------
http://www.directxzone.org
http://rdunlop.spaces.live.com/
Microsoft DirectX MVP 1998-2006
Nov 8 '07 #6

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

Similar topics

2
by: jorge | last post by:
Hello I have the following situation: (everything is dynamic (controls.add)) 1. Button.Init { WasButtonClickFired = true } 2. TextBox.TextChanged { WasButtonClickFired?
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: gaurav | last post by:
There are two text box, one is from date and another is to date textbox. Each text box having a calender popup button to select From date and To date. Both text box having a TextChanged event...
1
by: Spencer H. Prue | last post by:
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...
2
by: moi | last post by:
Hello, i would like a sample code to call a button click with the event "textchanged" of a textbox. I just would like to valide a textbox with the textchanged event and not to click on the submit...
0
by: moi | last post by:
Hello, I have a formview with a textbox and a button with an Insert commandname. I have put a textchanged event without a autopostback and i see that when i click the button, the textchanged's...
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: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)...
4
by: tshad | last post by:
I am just getting started with events and had a couple of questions on why they do what they do. If you have a textbox and you want to handle an event you can just do: ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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.