Cancel button on [Enter] key press does not fire

Cancel button on [Enter] key press does not fire

am 27.12.2007 16:31:53 von gnewsgroup

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.