Enter and the Button Click Event

Posted by: 4GuysFromRolla.com Headlines, on 08 Jun 2005 | View original | Bookmarked: 0 time(s)

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 >

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 2360 | Hits: 117

Similar Posts

  • Drop-Down Menu Button with Telerik ContextMenu for Silverlight more
  • Customizing the header of RadPane control and adding behavior to it. more
  • Creating Objects with Observable Properties in JavaScript more
  • The Telerik CAB Enabling Kit and SCSF - Tutorial 5: The RadPanelBar UIExtensionSite more
  • Tell the Debugger to Ignore Silverlight Validation Exceptions more
  • The Telerik CAB Enabling Kit and SCSF - Tutorial 6: The RadTreeView UIExtensionSite more
  • StreamInsight more
  • Getting Loopy (Matt Gertz) more
  • October Rules Fest 2009. See you in Dallas more
  • A Default Command for Silverlight more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD