Reputation: 1474
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 usercontrol). 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.
Upvotes: 1
Views: 4908
Reputation: 37533
Put your controls inside a panel and set that panel's DefaultButton
property.
Upvotes: 9
Reputation: 19425
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.
Upvotes: 1