how to change default ENTER key behaviour on a button/form

Discussion in 'ASP .Net' started by Flip, Nov 17, 2004.

  1. Flip

    Flip Guest

    On my current form, when I hit the enter key in a texbox, the form appears
    to resubmit itself, but it's not actually doing a submit (or so I think?).
    I would like to have the enter button fire the logic I have for the button.
    In other words, I would like to have a default button for the form, is this
    making sense?

    I thought I saw on Fritz Onion's MSDN webcasts there is a way to assign a
    default button to a form/page, is this in fact possible?

    I'm sorry, I'm new to c# (and loving it much more than jsps! :>). Thanks
    for any help.
     
    Flip, Nov 17, 2004
    #1
    1. Advertising

  2. Flip

    John M Deal Guest

    By default ASP.Net will press the first button in the tab order on the
    page. If you want to change that behavior so that you get to pick the
    button that is "clicked" when you hit enter then take a look at the
    conversation here:

    http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20944907.html

    You should also be able to use that to determine how to modify
    clientside behavior as well. Hope that helps.

    Have A Better One!

    John M Deal, MCP
    Necessity Software

    Flip wrote:
    > On my current form, when I hit the enter key in a texbox, the form appears
    > to resubmit itself, but it's not actually doing a submit (or so I think?).
    > I would like to have the enter button fire the logic I have for the button.
    > In other words, I would like to have a default button for the form, is this
    > making sense?
    >
    > I thought I saw on Fritz Onion's MSDN webcasts there is a way to assign a
    > default button to a form/page, is this in fact possible?
    >
    > I'm sorry, I'm new to c# (and loving it much more than jsps! :>). Thanks
    > for any help.
    >
    >
     
    John M Deal, Nov 17, 2004
    #2
    1. Advertising

  3. Flip

    Saravana Guest

    Check out this article,
    http://www.allasp.net/enterkey.aspx

    --
    Saravana
    http://dotnetjunkies.com/WebLog/saravana/
    www.ExtremeExperts.com


    "Flip" <[remove]> wrote in message
    news:#...
    > On my current form, when I hit the enter key in a texbox, the form appears
    > to resubmit itself, but it's not actually doing a submit (or so I think?).
    > I would like to have the enter button fire the logic I have for the

    button.
    > In other words, I would like to have a default button for the form, is

    this
    > making sense?
    >
    > I thought I saw on Fritz Onion's MSDN webcasts there is a way to assign a
    > default button to a form/page, is this in fact possible?
    >
    > I'm sorry, I'm new to c# (and loving it much more than jsps! :>). Thanks
    > for any help.
    >
    >
     
    Saravana, Nov 18, 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. bsm
    Replies:
    0
    Views:
    1,311
  2. James

    Web Form - Default Button For Enter Key

    James, Sep 11, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    252
    Lewis Wang [MSFT]
    Sep 12, 2003
  3. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    404
    Anders Matthiessen
    Jan 12, 2005
  4. Matt
    Replies:
    1
    Views:
    511
    Michael Winter
    Mar 6, 2004
  5. bsm
    Replies:
    3
    Views:
    287
Loading...

Share This Page