Button should not be the default control when pressing enter

Discussion in 'ASP .Net' started by George Homorozeanu, Jul 19, 2005.

  1. Hi,

    I have an ASP.Net Page with some control on it (buttons, textboxes,
    calender, etc). When I'm changing the text in the textbox I want to run some
    code and change the date of the calendar. The problem is that when I press
    enter, the code for the button event is called. It looks like the button is
    the default action for pressing enter somewhere on the page. How can I
    change that? The button is an asp button.

    Thanks,
    George.
    George Homorozeanu, Jul 19, 2005
    #1
    1. Advertising

  2. George Homorozeanu

    Brock Allen Guest

    Why don't you use an <input type=button> instead and then attach your onclick
    attribute to that? You can still make it runat=server if you'd like to work
    with it on the server.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi,
    >
    > I have an ASP.Net Page with some control on it (buttons, textboxes,
    > calender, etc). When I'm changing the text in the textbox I want to
    > run some code and change the date of the calendar. The problem is that
    > when I press enter, the code for the button event is called. It looks
    > like the button is the default action for pressing enter somewhere on
    > the page. How can I change that? The button is an asp button.
    >
    > Thanks,
    > George.
    Brock Allen, Jul 19, 2005
    #2
    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,757
  2. Philip Townsend

    button focus and pressing enter

    Philip Townsend, Aug 25, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,243
    Philip Townsend
    Aug 25, 2003
  3. Dan Brussee

    Default button - pressing Enter

    Dan Brussee, Feb 19, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    459
  4. Neo
    Replies:
    2
    Views:
    3,197
    bruce barker
    May 11, 2004
  5. HopfZ
    Replies:
    0
    Views:
    561
    HopfZ
    Aug 28, 2006
Loading...

Share This Page