We are creating a new user control using a boi开发者_开发百科ler plate template for our application. We noticed that anytime a textbox on the new user control has a focus and the enter key is pressed, the form executes a postback. This happens even if the AutoPostback on the text box is set to true. No other user controls in our app behave this way. What could be some of the places for me too look?
Thanks!
This is default browser behaviour.
Check the answer here to turn it off.
HDI: Disable postback on html input box
The typical behavior when the enter key is pressed inside of a form is to submit the form. What you probably want to do is trap the key event and cancel it to prevent the form from submitting, but maybe you could be more specific about what you DO want to submit your form.
精彩评论