ASP.Net page enter key causing post back
- You could set the DefaultButton on the Form or a Panel. This way you have full control what happens.
- Set UseSubmitBehavior="False" on your Buttons. This disables the "AutoPostback" on Enter.
I would prefer the second if i wanted to prevent Postbacks on Enter completely.
are you using jQuery?
if so:
$(document).keypress(function(e)
{
if(e.keyCode === 13)
{
e.preventDefault();
return false;
}
});