move the <Enter> focus between 2 buttons

Discussion in 'ASP .Net' started by Rocio, May 20, 2004.

  1. Rocio

    Rocio Guest

    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!
    Rocio, May 20, 2004
    #1
    1. Advertising

  2. 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/showdoc.asp?id=28&menuid=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" <> wrote in message
    news:...
    > 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!
    Steve C. Orr [MVP, MCSD], May 20, 2004
    #2
    1. Advertising

  3. 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!
    Rocio Katsanis, May 21, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roger
    Replies:
    1
    Views:
    632
    GreggTB
    May 20, 2005
  2. Eduardo78
    Replies:
    0
    Views:
    248
    Eduardo78
    Nov 3, 2005
  3. Andrew Tomazos
    Replies:
    2
    Views:
    614
    Nobody
    Dec 12, 2011
  4. HopfZ
    Replies:
    0
    Views:
    564
    HopfZ
    Aug 28, 2006
  5. Roger
    Replies:
    3
    Views:
    322
Loading...

Share This Page