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

Strange side effect with events

P: n/a
I have a text box with a seperate "submit" button which triggers an event
handler to process the text in the textbox. I also wanted to allow a user to
press enter to get out of the textbox and process the text. I wired up
another event handler for the textbox for the 'text changed' event. The
problem is when a user enters after writting text in text box the 'text
changed' event fires AND a random event for a whole seperate button at the
top of the page also fires. I tried to figure out the problem by disabling
that particular button but, some other random button started acting the same
way. If anyone has had this problem or knows the solution please let me
know.
Thank you,
Giancarlo
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What you want to do is tie the enter button of the textbox to the save
button being clicked.

What's happening is when you press enter, the first submit button on the
form is being fired - which is clearly not the save button.

Check out:
http://www.allasp.net/enterkey.aspx

which has a helper method that ties the enter of a textbox to the button of
your choice.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Giancarlo" <Gi*******@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
I have a text box with a seperate "submit" button which triggers an event
handler to process the text in the textbox. I also wanted to allow a user to press enter to get out of the textbox and process the text. I wired up
another event handler for the textbox for the 'text changed' event. The
problem is when a user enters after writting text in text box the 'text
changed' event fires AND a random event for a whole seperate button at the
top of the page also fires. I tried to figure out the problem by disabling that particular button but, some other random button started acting the same way. If anyone has had this problem or knows the solution please let me
know.
Thank you,
Giancarlo

Nov 19 '05 #2

P: n/a
Thank you very much Karl, that was problem I've been dealing with for a while
now. I appreciate your knowledge and helpfulness.

"Karl Seguin" wrote:
What you want to do is tie the enter button of the textbox to the save
button being clicked.

What's happening is when you press enter, the first submit button on the
form is being fired - which is clearly not the save button.

Check out:
http://www.allasp.net/enterkey.aspx

which has a helper method that ties the enter of a textbox to the button of
your choice.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Giancarlo" <Gi*******@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
I have a text box with a seperate "submit" button which triggers an event
handler to process the text in the textbox. I also wanted to allow a user

to
press enter to get out of the textbox and process the text. I wired up
another event handler for the textbox for the 'text changed' event. The
problem is when a user enters after writting text in text box the 'text
changed' event fires AND a random event for a whole seperate button at the
top of the page also fires. I tried to figure out the problem by

disabling
that particular button but, some other random button started acting the

same
way. If anyone has had this problem or knows the solution please let me
know.
Thank you,
Giancarlo


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.