Submitting an ASP.NET form by pressing the Enter key results in a Page Not Found error

For a SharePoint website I was developing user controls that inherit from the ASP.NET 2.0 Membership controls. Submitting the custom login and password recovery controls by clicking the submit button worked as expected. However, submitting the controls by pressing the Enter key on my keyboard resulted in an unexpected "Page not found" error.

The problem was that the default button for the form was not referencing the submit button of the user control. Bind the UniqueID of the submit button to the page form's DefaultButton property. Don't use the ID string directly; use the UniqueID property instead, because ASP.NET automatically created unique ID values.

An example of assigning the DefaultButton property of the page form:

Page.Form.DefaultButton = YourSubmitButton.UniqueID;

Published Wed, Nov 12 2008 9:42 PM by Harold van de Kamp
Filed under: ,

Comments

# re: Submitting an ASP.NET form by pressing the Enter key results in a Page Not Found error

Monday, June 15, 2009 2:34 PM by gabriella

could  you explain more?

thx

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 5 and 8 and type the answer here: