2

On most of my webapps pages using the Master Page, the first button is a "close window"-button that will by default be executed when the enterkey is pressed. In these scenarios, I want nothing to happen instead.

I have made this work with a very ugly solution: I create an invisible button on the Masterpage and set it as the defaultbutton, and override the defaultbutton property on the pages where I actually want something to happen. There are 2 problems with this solution: 1) it is ugly, 2) a postback is made when the enterkey is pressed forcing the page to refresh, which could lead users to believe that they've achieved something by pressing the button.

Is there a better way to solve this?

Soroush Hakami
  • 5,226
  • 15
  • 66
  • 99

1 Answers1

4

Set the Close-Button's UseSubmitBehavior-Property to False.

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939