Default button - pressing Enter

Discussion in 'ASP .Net' started by Dan Brussee, Feb 19, 2004.

  1. Dan Brussee

    Dan Brussee Guest

    I have a form with 2 or more buttons. How do I control which one will
    fire when I press the Enter key? In traditional ASP, I could create 2
    or more forms, each with their own Submit buttons. Since there is only
    one form, how do I control which of the submit buttons will fire?
     
    Dan Brussee, Feb 19, 2004
    #1
    1. Advertising

  2. Dan Brussee

    Rajiv R Guest

    Hi Dan,

    these URLs will help.

    http://www.developer.com/net/asp/article.php/1594521
    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=u$MfvC
    nrBHA.2072%40tkmsftngp07&rnum=2&prev=/groups%3Fq%3Ddefault%2Bbutton%2BASP%2B
    ..NET%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den
    http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=18

    hope they help.

    --
    Cheers!
    Rajiv. R
    Rajspace.Org

    "Dan Brussee" <> wrote in message
    news:...
    > I have a form with 2 or more buttons. How do I control which one will
    > fire when I press the Enter key? In traditional ASP, I could create 2
    > or more forms, each with their own Submit buttons. Since there is only
    > one form, how do I control which of the submit buttons will fire?
     
    Rajiv R, Feb 19, 2004
    #2
    1. Advertising

  3. Dan Brussee <> wrote in
    news::
    > I have a form with 2 or more buttons. How do I control which one will
    > fire when I press the Enter key? In traditional ASP, I could create 2
    > or more forms, each with their own Submit buttons. Since there is only
    > one form, how do I control which of the submit buttons will fire?


    Use JS and capture the enter key. You can then tell it to do what you want.




    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"
     
    Chad Z. Hower aka Kudzu, Feb 19, 2004
    #3
  4. Dan Brussee

    Max Guest

    Page.RegisterHiddenField("__EVENTTARGET", "bSearch")

    in the Page_Load sub works

    If this is in a user control, I've learned that you need to change the
    "bSearch" to the NAME of the button as it is rendered on the page. So since
    my button is actually inside a user control, I had to do:

    Page.RegisterHiddenField("__EVENTTARGET", "WucPager1:bSearch")

    -Max

    > "Dan Brussee" <> wrote
    > > I have a form with 2 or more buttons. How do I control which one will
    > > fire when I press the Enter key? In traditional ASP, I could create 2
    > > or more forms, each with their own Submit buttons. Since there is only
    > > one form, how do I control which of the submit buttons will fire?

    >
    >
    >
     
    Max, Feb 24, 2004
    #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. Philip Townsend

    button focus and pressing enter

    Philip Townsend, Aug 14, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    8,791
  2. Philip Townsend

    button focus and pressing enter

    Philip Townsend, Aug 25, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,268
    Philip Townsend
    Aug 25, 2003
  3. Neo
    Replies:
    2
    Views:
    3,242
    bruce barker
    May 11, 2004
  4. George Homorozeanu
    Replies:
    1
    Views:
    364
    Brock Allen
    Jul 19, 2005
  5. GOKU24
    Replies:
    0
    Views:
    165
    GOKU24
    Aug 26, 2003
Loading...

Share This Page