A typical data-entry page usually consists of a variety of form fields for collecting user input along with a Submit button.
To create such a page, you'd add the appropriate set of Web controls onto your ASP.NET page - a dash of TextBoxes and a sprinkle
of CheckBoxLists, perhaps - along with a Button Web control. Once the user interface portion was complete you'd wrap up the
project by creating an event handler for the Button Web control's Click event and there add code to take
whatever action was needed... perhaps you'd save the data to a database, or send the information to someone via an email.
When filling out such forms you have probably experienced the fact that if you hit enter when typing in a textbox the form
submits. This is a feature that browsers provide to make it possible to submit a form without having to touch the mouse.
For example, if you hit up Google focus is immediately set to the search textbox and, after typing in your query, you can
hit Enter to see the results.
Of particular interest to ASP.NET developers, though, is that when creating an ASP.NET Web Form hitting Enter to submit the
form seemingly sometimes causes the page's Button Web control's Click event to fire, and other times not. In
this short article we'll see under what conditions a Button Web control's Click event might not fire when the
user submits the page hitting Enter; furthermore, we'll look at a workaround. Read on to learn more!
Read More >