Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

How to prevent textbox postback when hitting Enter key in ASP.NET

4.91/5 (9 votes)
24 Oct 2011CPOL 28.5K  
This seems to do the job:

This seems to do the job:


ASP.NET
<asp:textbox id="tbTest1" runat="server" onkeypress="return event.keyCode != 13;" />

License

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