Default Button behavior for Submit ?


Is there a way to set a button as the default if the user presses the enter key – like on a login page.

(Like ASP.NET forms)

I see the “Shortcut Key” property but ENTER is not one of the choices.

  • You must to post comments

It’s not that easy with ASP.NET forms. It used to drive me crazy and I always ended up having to add javascript to find the submit button using a custom property and make it the default one.

With Wisej you can decide what to do when the user presses Return in several ways, here are two:


  1. Set the AcceptButton property of the form to the button that you want to click when pressing Return. There is also the CancelButton property for the Esc key.
  2. Use the Accelerators property on a container (any container) and the Accelerator event. The Accelerators collection lets you define a number of keys that when pressed in any of the child controls at any level trigger the Accelerator event at the container level. The event’s args contain the key and the control that had the focus when the key was pressed.



  • edmond girardi
    Thanks – I used the AcceptButton Property and it works.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.