473,748 Members | 4,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1822
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************ @softwareservic es.net> wrote in message
news:7b******** *************** ***@posting.goo gle.com...
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
24345
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 <Enter>-key.
4
1651
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 can do in Access. I personally have never run across something like this, but I am still young in the .NET Programming world so perhaps I just haven't run across it yet. Thanks for the help.
7
20371
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 browsers? The script bellow is IE only. It fails FF 1.0 and NN 7. Also, if I can trap the keypress I would like to use it to tab to the next tabindex.
7
6704
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 me to some information on how to disable this function (and how to re-enable it)? I believe that I saw some article that showed how to incorporate this into a command button. That would work for me as I have three different sign-on authorities...
0
1295
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 make the cursor jump to the following line in the textbox? For some reason, and this happens everywhere except on my development PC (and it's not consistent), if a user's writing a line and presses the <Enter> key, the program interprets that as...
2
9476
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 Button a default so that when users hit <ENTER> key, Login Button receives a click. Please help!
5
2023
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
1826
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, everything works okay. I can press <ENTER> when the cursor is inside the text box and the page is running, and no events fire (this is what I expect). But as soon as I drop a second text box on the page (ie: after th first one) then pressing...
4
4859
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 list and the textbox is populated with the option when the user presses the enter button. This is for a VB.NET Web form type project. The problem is that when I press the enter button the entire form get
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9241
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.