Question: I have a <input> with an onclick event which checks for the Enter key. The called function may do a window.location redirect.

However, when I press the Enter key, it apparently fires off the page validation. So I see the validation messages for a split second.

How can I tell the page not to fire any of the validation events when the focus is in that <input>?

Answer: 
If it's an <asp:Button>, just set the [CausesValidation](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation.aspx) property to false. But, I *suspect* that it's not actually the button that's causing it - but the form submit that happens as a resul of the Enter key.

If that's the case, you can use the [client side API](http://msdn.microsoft.com/en-us/library/aa479045.aspx#aspplusvalid_clientside) and set `Page_ValidationActive = false;` when focus changes.
Set [ValidationGroup](http://msdn.microsoft.com/en-us/library/ms227424.aspx) property of your validation controls. After that define ValidationGroup property to your button that you want to fire validation.

Also setting [Causesvalidation](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.causesvalidation.aspx) property to false might help.