enter button as submit?

  • Thread starter Thread starter Eddie B.
  • Start date Start date
E

Eddie B.

Does anyone know how to make my enter button act as submit? I am trying to
eliminate the user having to click an extra button, I want the user to be
able to type a word and hit enter.

Thanks,

Eddie

P.S. Happy Halloween
 
Try this

Page.RegisterHiddenField("__EVENTTARGET", "btnSave");

where btnSave is your submit button, and make sure this code runs whether or
not the page is in PostBack
 
You need to set javascript to do this.

TEXTBOX.Attributes.Add("onkeydown", "if ((event.which && event.which
== 13) || (event.keyCode && event.keyCode == 13))
{document.FORMNAME.BUTTONNAME.click(); return false;} else return
true;");
 
Back
Top