I want a user to enter data into a textbox and then be able to either hit return or click a command button to retrieve the data. The command button works fine, but how do I get it to fire when the user hits the return key when they're still at the textbox?
Homer: Good question. Paul(link9)I believe posted the javascript routine for this but haven't seen it in some time (I am also looking for this solution). I believe it is trigger in java as the OnChange event. You might do a search here and at the java forum.
It's not javascript, it's just a little different approach to setting up the form.
Declare the button you want to work with "Enter" as a regular old <input type=button> except add the runat=server, an id, and an onServerClick attribute.
Also, you must make the button the first in your form:
Thanks for the tip Paul. However I'll throw a wrench into your solution and ask what if the button isn't the first button on the form? Then what can I do to make it fire when a users hits return in the textbox?
As far as I have seen there is nothing you can do in this case Homer. If you don't want the button to be positioned as first on the page you can use absolute positioning to accomplish the same thing. You just have to ensure that the button is the first button declared in your rendered html. That'l do donkey, that'l do
Mark
If you are unsure of forum etiquette check here faq796-2540
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.