Hi,
I have a control embedded in an asp.net (2.0) page. When the control is on a page I want the default behaviour when the return key is press to run an action on the control, not anything on the page. To this end I found that setting
UseSubmitBehaviour="false"
on the buttons on the page worked great. This was fine until I needed to have a confirmation window appear when this button on the page was clicked. When they push that button they are permanently deleting records from the system and want to make sure they are clicking the correct button. The button looks like this:
<asp:Button runat="server" ID="btnDeleteCollationResultstop" Text="Delete Selected" UseSubmitBehavior="true"
ToolTip="Delete all the selected items in the Collation tool" OnClick="btnDeleteCollationResults_Click"
OnClientClick="return confirm('Are you sure you wish to Delete the selected Item(s)?');" />
The popup confirmation window does load and work if I set UseSubmitBehaviour to true but then the return key fires the delete button, which again I really don't want.
So my question is how can I get it to do the following:
1) make default action of the return key to fire on my control and not the page it is in
2) ensure a confirmation window appears when the user clicks the delete button and only proceed if they confirm the deletion?
Thanks
Jon
EDIT
One idea I just had would be to make it so that none of the buttons submit back on return, and hook in some JQuery to listen for Return and do the submit for the button I want, (don't know how to do that straight away though).