Click here to Skip to main content
11,410,750 members (63,592 online)
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

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

, 24 Oct 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
This seems to do the job:

This seems to do the job:

<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)

Share

About the Author

Steverey42

United States United States
No Biography provided

Comments and Discussions

 
Generalthis is simple but you wil have to write onkeypress for each... PinmemberRam Balak Sharma13-Dec-11 2:57 
Generalprecise and simple 5! PinmemberUday P.Singh5-Nov-11 1:13 
GeneralReason for my vote of 5 Excellent concise answer Pinmembertonysawyer2-Nov-11 2:11 
GeneralReason for my vote of 4 Much simpler than above... thanks f... PinmemberBrianBissell1-Nov-11 4:13 
Reason for my vote of 4
Much simpler than above...

thanks for sharing
GeneralReason for my vote of 5 thanks for tip Pinmemberbeginner201131-Oct-11 16:35 
GeneralReason for my vote of 5 Short & simple Pinmvpthatraja26-Oct-11 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.5 | Last Updated 24 Oct 2011
Article Copyright 2011 by Steverey42
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid