hitting the "enter" key

Discussion in 'ASP .Net' started by PJ6, Aug 24, 2005.

  1. PJ6

    PJ6 Guest

    I want to be able to, depending on the state of the page, direct what the
    ENTER key causes the page to do.

    The problem I'm having is I have a user control with a textbox and an
    "enter" button. If this control is in a certain state, when the user hits
    the ENTER key on that page, I want the ENTER event to be sent to the ENTER
    button in that control, like the defuault button-clicking behavior I'm
    seeing when a button is in the form istelf and not within a user control.

    Is that possible?

    Paul
    PJ6, Aug 24, 2005
    #1
    1. Advertising

  2. PJ6

    mathlec Guest

    mathlec, Aug 24, 2005
    #2
    1. Advertising

  3. You could use this free control to solve the problem.
    http://www.metabuilders.com/tools/DefaultButtons.aspx

    And here are a couple good articles on the subject:
    http://www.allasp.net/enterkey.aspx
    http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp

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


    "PJ6" <> wrote in message
    news:...
    >I want to be able to, depending on the state of the page, direct what the
    >ENTER key causes the page to do.
    >
    > The problem I'm having is I have a user control with a textbox and an
    > "enter" button. If this control is in a certain state, when the user hits
    > the ENTER key on that page, I want the ENTER event to be sent to the ENTER
    > button in that control, like the defuault button-clicking behavior I'm
    > seeing when a button is in the form istelf and not within a user control.
    >
    > Is that possible?
    >
    > Paul
    >
    Steve C. Orr [MVP, MCSD], Aug 25, 2005
    #3
  4. PJ6

    The EEEdiot Guest

    You can also use something like:

    Private Sub Page_PreRender(...) Handles MyBase.PreRender
    DoSearch()
    End Sub

    Private btnSearch_Click(...) Handles btnSearch.Click
    Do Search()
    End Sub

    Private Sub DoSearch()
    ....
    End Sub

    When they hit the Enter key it will act as if they hit the button.

    "PJ6" <> wrote in message
    news:...
    >I want to be able to, depending on the state of the page, direct what the
    >ENTER key causes the page to do.
    >
    > The problem I'm having is I have a user control with a textbox and an
    > "enter" button. If this control is in a certain state, when the user hits
    > the ENTER key on that page, I want the ENTER event to be sent to the ENTER
    > button in that control, like the defuault button-clicking behavior I'm
    > seeing when a button is in the form istelf and not within a user control.
    >
    > Is that possible?
    >
    > Paul
    >
    The EEEdiot, Aug 25, 2005
    #4
    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. Andy G

    Hitting the enter key

    Andy G, Dec 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,555
    Andy G
    Dec 28, 2004
  2. Sunfire
    Replies:
    2
    Views:
    1,058
    Sunfire
    Nov 6, 2007
  3. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    389
    Anders Matthiessen
    Jan 12, 2005
  4. M P
    Replies:
    1
    Views:
    466
  5. Megha Vishwanath
    Replies:
    3
    Views:
    703
    Megha Vishwanath
    Jul 20, 2004
Loading...

Share This Page