Cancel button on [Enter] key press does not fire

Cancel button on [Enter] key press does not fire

Post by gnewsgrou » Sat, 29 Dec 2007 00:31:53

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

[ 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

1. Pressing enter key in a text box somtimes presses the last button!

2. Automatically Invoking an Focussed Button without pressing Enter key or Mouse Button


I have a small problem regarding the Focussed button. In my project i
will call an exe so that an pop up will come with 2 Buttons.

In those 2 buttons one will be focussed deafultly. Now my application
should invoke the focussed button automatically. Means there won't be
Pressing ENTER KEY or Mouse Button Etc. My intention is that, the
application should do that automatically.

I have tried with getting the handle of the focussed Button by GetFocus
method and tried to send that handle to the application by SendMessage and
PostMessage. But it's not working.

so can any body give some suggestion regarding this ?

Waiting for your reply.



3. pressing enter clears text field, not press button, why???

4. pressing enter clears text field, not press button, why???

5. Cancel the "enter key" press event in FirFox version 1.0.7

6. Press any key, not any key + enter

7. press enter key for send button

8. "Enter" key presses wrong button on QC search form.

9. trigger click on button when Enter Key is pressed

10. Pressing Enter Key from a Textbox (Netscape 4.79) and simulate a button-click

11. Automatically invoking the Focussed Button without pressing the Enter key or Mouse click

12. Help:How to avoid button click event when Enter key is press in a TextBox?

13. Enter key not being captured - not firing KeyDown

14. Default Button pressed when Enter is Pressed

15. when i press enter, logoff button is pressed