Community blog feed

Enter button and several inputs

Website
Blog
ASP.NET Cafe
Posted
03 Jul 2009 at 05:43

Summary

In ASP.NET you have sometimes a problem. When you have several inputs (textboxes) and several buttons. You want user to submit it by hitting enter. For example one login box, one search box. You want to submit login box when user hits enter in password field, and search button when user hits enter in search field. The solution is easy! Just put controls inside the asp:panel with attribute DefaultButton="ButtonFind" ( where ButtonFind is ID of desired default button ). That's all!

Post extract

In ASP.NET you have sometimes a problem. When you have several inputs (textboxes) and several buttons. You want user to submit it by hitting enter. For example one login box, one search box. You want to submit login box when user hits enter in password field, and search button when user hits enter in search field. The solution is easy! Just put controls inside the asp:panel with attribute DefaultButton="ButtonFind"  ( where ButtonFind is ID of desired default button ). That's all! It works!

We'd love to hear what you think! Submit ideas or give us feedback