carriage return in a textbox -> click a button?

Discussion in 'ASP .Net' started by HockeyFan, Sep 28, 2007.

  1. HockeyFan

    HockeyFan Guest

    I've done this before by trapping keydown and checking for a CR, and
    then clicking a particular button based on which textbox the event
    happened. However, I was wondering if there's a simpler way to trap a
    carriage return in a textbox, and have it click a button?
    HockeyFan, Sep 28, 2007
    #1
    1. Advertising

  2. In ASP.NET 2.0 the panel control has a new DefaultButton property.
    Set this property to the ID of a button control and it will be the default
    button when focus is in that panel.

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


    "HockeyFan" <> wrote in message
    news:...
    > I've done this before by trapping keydown and checking for a CR, and
    > then clicking a particular button based on which textbox the event
    > happened. However, I was wondering if there's a simpler way to trap a
    > carriage return in a textbox, and have it click a button?
    >
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Sep 28, 2007
    #2
    1. Advertising

  3. HockeyFan

    HockeyFan Guest

    Does this mean that the default button gets clicked when a carriage
    return is pressed inside a textbox?


    On Sep 28, 10:09 am, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
    <> wrote:
    > In ASP.NET 2.0 the panel control has a new DefaultButton property.
    > Set this property to the ID of a button control and it will be the default
    > button when focus is in that panel.
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net
    >
    > "HockeyFan" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > I've done this before by trapping keydown and checking for a CR, and
    > > then clicking a particular button based on which textbox the event
    > > happened. However, I was wondering if there's a simpler way to trap a
    > > carriage return in a textbox, and have it click a button?- Hide quoted text -

    >
    > - Show quoted text -
    HockeyFan, Sep 28, 2007
    #3
  4. Yes.

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


    "HockeyFan" <> wrote in message
    news:...
    > Does this mean that the default button gets clicked when a carriage
    > return is pressed inside a textbox?
    >
    >
    > On Sep 28, 10:09 am, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
    > <> wrote:
    >> In ASP.NET 2.0 the panel control has a new DefaultButton property.
    >> Set this property to the ID of a button control and it will be the
    >> default
    >> button when focus is in that panel.
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr,
    >> MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net
    >>
    >> "HockeyFan" <> wrote in message
    >>
    >> news:...
    >>
    >>
    >>
    >> > I've done this before by trapping keydown and checking for a CR, and
    >> > then clicking a particular button based on which textbox the event
    >> > happened. However, I was wondering if there's a simpler way to trap a
    >> > carriage return in a textbox, and have it click a button?- Hide quoted
    >> > text -

    >>
    >> - Show quoted text -

    >
    >
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Sep 29, 2007
    #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. Simon Middlemiss
    Replies:
    2
    Views:
    5,237
    Jacob Yang [MSFT]
    Nov 10, 2003
  2. dancer

    Textbox Carriage Return

    dancer, May 17, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,719
    dancer
    May 18, 2007
  3. Mike Owen

    Multi-line textbox control - Carriage return?

    Mike Owen, Aug 8, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    1,041
    Mike Owen
    Aug 8, 2003
  4. Xeno Campanoli
    Replies:
    0
    Views:
    227
    Xeno Campanoli
    Feb 13, 2006
  5. Steve Anderson
    Replies:
    3
    Views:
    248
    Steve Anderson
    Jun 21, 2004
Loading...

Share This Page