Thursday 17 January 2008

Disabling the Enter Button to avoid triggering clientside code

While working on a recent project the users found that when they hit the enter key a client-side confirmation box kept being triggered for Logging Out.

A simple way to avoid this is to set the forms default button property to whichever control you want the Enter button to be connected to.

Eg.

<form id="form1" runat="server" defaultbutton="myButton">

You can also do this with Panel controls.

No comments: