By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.