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

move the <Enter> focus between 2 buttons

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!
Nov 18 '05 #1
2 1808
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" <ro************@softwareservices.net> wrote in message
news:7b**************************@posting.google.c 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!

Nov 18 '05 #2

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!
Nov 18 '05 #3

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

Similar topics

11
by: Denis Hierstein | last post by:
I need a function, witch make a break in a for-loop and wait for the <enter>-key ... when I use Pascal I just use the Read; or the ReadLn;-function, then the loop stop as long as the user push the...
4
by: bh | last post by:
So, I am debating with someone about this. He believe that you can set up so when the user presses Enter it acts just like Tab, so it follows the tab order between text boxes in .NET just like you...
7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
7
by: Susan Bricker | last post by:
I know that I saw some information concerning the <shift>+<enter> combination use to bypass launching an Access mdb application and enter the Access design workspace. Would someone please direct...
0
by: VMI | last post by:
If I'm in a multi-line textbox and I'm writing a postal address (ie. write ist line and press <Enter>, write 2nd line and press <Enter>, etc...) how can I make sure that the Enter key will always...
2
by: JP | last post by:
Hi, It's a login screen, so users enter their ID/Password and hit <ENTER> instead of clicking on Login button. But when they hit <ENTER> an Image Button gets clicked. I want to make my Login...
5
by: DotNetGruven | last post by:
Hi, I have a web form which has: - Login area with - email textbox - password textbox - <enter> button to log in - search area with - string to search for textbox
0
by: Tom Edelbrok | last post by:
I'm using VS 2005 to develop an intranet asp.net web application and I get a weird situation. If I start out with any ASPX page that contains an ImageButton control followed by a TextBox control,...
4
by: almurph | last post by:
Hi everyone, I'm a newbie to javascript. I have written some code to detect when a user presses the down-arrow, up-arrow and enter button. Essentially the user can arrow down or up through a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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,...

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.