开发者

ASP.Net ImageButton stealing Enter key press

I have an ASP.Net page with a usercontrol on it. The submit button for the page is within the usercontrol. There is an ImageButton on the page itself (outside of the user开发者_运维技巧control). Whenever I hit the enter key to submit the form, it always executes the ImageButton click instead of the submit button within the usercontrol.

I'm using a MasterPage for the style, so the form is within that which rules out using the form's DefaultButton property.


Put your controls inside a panel and set that panel's DefaultButton property.


Add focus on page load.

This example might help: http://www.webmasterworld.com/forum91/1611.htm

It sets the focus on submit button, but focus will be lost when you click a text field in the form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜