Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > move the <Enter> focus between 2 buttons

Reply
Thread Tools

move the <Enter> focus between 2 buttons

 
 
Rocio
Guest
Posts: n/a
 
      05-20-2004
I have a aspx page, with 2 controls (ascx).

Control1 contains a SEARCH button, and textbox to enter the string to
search for.
Control 2 contains a LOGIN button, and 2 text boxes to enter the
username & password to login.
Any user can perform a search, but if he applies for an account, he
can login and performed an enhanced search.

Currently, the SEARCH button responds when the user clicks <Enter>,
which works find if he is doing a search.

But if he has an account and enters his username & passowrd and
presses <Enter> the command goes to the SEARCH button, this case doing
nothing since he did not enter anything to search for.

How can I switch the focus of the <Enter> from SEARCH to LOGIN buttons
in the same page? I'm figuring, when the user focuses in the
txtUserName for example, I would like to change the focus from the
SEARCH button to the LOGIN when he presses <Enter>.

Is this possible? Anyone knows how?

TX! in advance!
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      05-20-2004
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a good article on the subject:
http://www.allasp.net/enterkey.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Rocio" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I have a aspx page, with 2 controls (ascx).
>
> Control1 contains a SEARCH button, and textbox to enter the string to
> search for.
> Control 2 contains a LOGIN button, and 2 text boxes to enter the
> username & password to login.
> Any user can perform a search, but if he applies for an account, he
> can login and performed an enhanced search.
>
> Currently, the SEARCH button responds when the user clicks <Enter>,
> which works find if he is doing a search.
>
> But if he has an account and enters his username & passowrd and
> presses <Enter> the command goes to the SEARCH button, this case doing
> nothing since he did not enter anything to search for.
>
> How can I switch the focus of the <Enter> from SEARCH to LOGIN buttons
> in the same page? I'm figuring, when the user focuses in the
> txtUserName for example, I would like to change the focus from the
> SEARCH button to the LOGIN when he presses <Enter>.
>
> Is this possible? Anyone knows how?
>
> TX! in advance!



 
Reply With Quote
 
 
 
 
Rocio Katsanis
Guest
Posts: n/a
 
      05-21-2004

Tx for your reply Steve.
As a matter of fact yesterday I did more research and found your reply
to a similar issue, pointing to the first link as a solution in this
reply.
It worked fine.

Thanks for the other information links as well.

-r


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing move constructors and move assignment Andrew Tomazos C++ 2 12-12-2011 01:45 PM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
How to move radio buttons into table cells?Help! =?Utf-8?B?ZGF2aWQ=?= ASP .Net 7 04-27-2006 05:23 PM
I am trying to move spaces to a weblistbox and when I move them... Eduardo78 ASP .Net Web Controls 0 11-03-2005 06:06 PM
move to windows 2k3..buttons not working SoCalGuy ASP .Net 2 03-10-2005 07:49 PM



Advertisments