Changing Default Submit Button

Discussion in 'ASP .Net' started by Don Miller, Apr 5, 2007.

  1. Don Miller

    Don Miller Guest

    I have a webpage (form) that has multiple buttons contained within, and all
    cause a postback if clicked. I have a textbox where users enter a phrase and
    then have to click a "Search" button that does a search for what was
    entered. Instead of requiring the user to manually mouseclick on the Search
    button, I would just like the user to be able to hit the Enter key to begin
    the search.

    I'm not sure exactly what happens when an Enter button is pressed.

    Is there a way to make any one button on the form (e.g. Search) the default
    action when the page is posted back?

    Thanks.
    Don Miller, Apr 5, 2007
    #1
    1. Advertising

  2. Don Miller

    Don Miller Guest

    This seems to work with a lot less effort than other "solutions" out there:

    http://daron.yondem.com/PermaLink.aspx?guid=d92c44c3-266b-4c48-be70-b053fe3c541e


    "Don Miller" <> wrote in message
    news:%...
    >I have a webpage (form) that has multiple buttons contained within, and all
    >cause a postback if clicked. I have a textbox where users enter a phrase
    >and then have to click a "Search" button that does a search for what was
    >entered. Instead of requiring the user to manually mouseclick on the Search
    >button, I would just like the user to be able to hit the Enter key to begin
    >the search.
    >
    > I'm not sure exactly what happens when an Enter button is pressed.
    >
    > Is there a way to make any one button on the form (e.g. Search) the
    > default action when the page is posted back?
    >
    > Thanks.
    >
    Don Miller, Apr 5, 2007
    #2
    1. Advertising

  3. I am not aware of any custom solutions, default behavior of the form
    is to trigger click event of the very first submit button on the form
    (first button from left to right and top to bottom of the page).
    donet programmer, Apr 5, 2007
    #3
  4. Don Miller

    bruce barker Guest

    the asp:panel supports a defaultbutton

    -- bruce (sqlwork.com)

    Don Miller wrote:
    > I have a webpage (form) that has multiple buttons contained within, and all
    > cause a postback if clicked. I have a textbox where users enter a phrase and
    > then have to click a "Search" button that does a search for what was
    > entered. Instead of requiring the user to manually mouseclick on the Search
    > button, I would just like the user to be able to hit the Enter key to begin
    > the search.
    >
    > I'm not sure exactly what happens when an Enter button is pressed.
    >
    > Is there a way to make any one button on the form (e.g. Search) the default
    > action when the page is posted back?
    >
    > Thanks.
    >
    >
    bruce barker, Apr 6, 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. Mark
    Replies:
    1
    Views:
    1,648
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,171
    Ghafran Abbas
    Oct 12, 2004
  3. James Storey via JavaKB.com
    Replies:
    7
    Views:
    11,407
  4. Andrew Crowe
    Replies:
    2
    Views:
    16,239
    Jukka K. Korpela
    Feb 6, 2004
  5. Replies:
    2
    Views:
    6,151
Loading...

Share This Page