Cancel button on [Enter] key press does not fire

Discussion in 'ASP .Net' started by gnewsgroup, Dec 27, 2007.

  1. gnewsgroup

    gnewsgroup Guest

    A aspx page of mine contains a user control in a Panel control. This
    user control has a textbox, a search button and a cancel button like
    this:

    [ txtSearchBox ] btnSearch btnCancel

    When btnSearch is clicked, I show the search result right in the user
    control. If btnCancel is clicked, the user control dissappears.

    Everything works OK if I simply use mouse-clicks.

    I have set the DefaultButton property of the panel to be btnSearch,
    and the btnSearch's click event fires when the [Enter] key is pressed.

    But, when I tab to btnCancel, and push the [Enter] key, it's still
    btnSearch's click event that fires. Note that I can clearly see that
    btnCancel is focused.

    How can I fix this problem? I am using AJAX, and this Panel is inside
    AJAX.
     
    gnewsgroup, Dec 27, 2007
    #1
    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. Andrea Williams

    Key press "Enter" does not submit the form

    Andrea Williams, May 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    7,447
    Steve C. Orr [MVP, MCSD]
    May 24, 2004
  2. Jie
    Replies:
    7
    Views:
    6,246
    Xavier Pacheco
    Oct 9, 2004
  3. David Lozzi
    Replies:
    3
    Views:
    979
    Karl Seguin [MVP]
    Oct 25, 2006
  4. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    442
    Anders Matthiessen
    Jan 12, 2005
  5. Replies:
    4
    Views:
    312
Loading...

Share This Page