How to control enter button on the client PC in ASP.Net

Discussion in 'ASP .Net' started by Simon Fainveits, Aug 11, 2003.

  1. Does anybody know how to control enter button on the web
    form? It seems to if the user hits enter button at run
    time then it fires submit button click event. I have also
    noticed that if the page does not have a submit button
    then the button that was first placed on the form at
    design time is fired and I do not want that to happen. Is
    there any way to control enter button behaviour?
    Many thanks
    Simon
     
    Simon Fainveits, Aug 11, 2003
    #1
    1. Advertisements

  2. You can intercept the client side enter keypress event of the text box and
    then click the correct button 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
    http://Steve.Orr.net


    "Simon Fainveits" <> wrote in message
    news:025401c35fab$740c5f00$...
    > Does anybody know how to control enter button on the web
    > form? It seems to if the user hits enter button at run
    > time then it fires submit button click event. I have also
    > noticed that if the page does not have a submit button
    > then the button that was first placed on the form at
    > design time is fired and I do not want that to happen. Is
    > there any way to control enter button behaviour?
    > Many thanks
    > Simon
     
    Steve C. Orr, MCSD, Aug 11, 2003
    #2
    1. Advertisements

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. Greg H
    Replies:
    1
    Views:
    543
    David Waz...
    Jul 3, 2003
  2. Lars Netzel

    The damn Enter button and ASP.NET

    Lars Netzel, Aug 15, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,104
    Grant Merwitz
    Aug 16, 2005
  3. TS
    Replies:
    5
    Views:
    14,894
    Jeffrey Tan[MSFT]
    Nov 29, 2005
  4. David Lozzi
    Replies:
    3
    Views:
    1,149
    Karl Seguin [MVP]
    Oct 25, 2006
  5. Sunfire
    Replies:
    2
    Views:
    1,239
    Sunfire
    Nov 6, 2007
  6. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    654
    Anders Matthiessen
    Jan 12, 2005
  7. Matt
    Replies:
    1
    Views:
    742
    Michael Winter
    Mar 6, 2004
  8. HopfZ
    Replies:
    0
    Views:
    952
    HopfZ
    Aug 28, 2006
Loading...