Back to previous

Setting Default Button for Textbox Upon Hitting Enter

This has to be pretty simple, but I never actually realised it. That is, when we have a textbox, and a button aside, and we want to enter text into the textbox and do a postback by hitting enter on our keyboard instead of hitting the button aside. This can easily be done by wrapping the controls inside a panel, and then set the defaultButton property to the button's id. Gee, I never knew that...

ShareThis

If you think this post is useful, please recommend me at the bottom of the page. ;)

Discussion