Click here to Skip to main content
15,886,074 members
Articles / Web Development / ASP.NET

How to make a button the default button on enter on an ASP.NET form

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
22 Jul 2011CPOL 21.4K   5  
You can set the default button on your form tag as below code.ORyou can set the default button on a panel as below.And you can place your...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
24 Jul 2011mahesh__kumar__sharma
function SetDefalutButton(e, buttonid){ var evt = e ? e : window.event; if (evt.keyCode == 13)/*Search if user hit enter key*/ { var bt = $('[id$='+buttonid+']'); if (bt.length > 0) { if (evt.keyCode == 13) { ...
Please Sign up or sign in to vote.
20 Jul 2011Bahram Ettehadieh 2 alternatives  
By putting your intended content in a division as bellow, the button you set as default button will be hit when you hit enter button on any element which is in the division.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions