Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

ASP.NET webform doesn't submit with 'Enter' key press

Experts,

I have discovered that my asp.net forms do not submit upon the 'Enter/Return' key being pressed.  So, on my login form, where users enter username and password followed by the return key (As users normally do), the form is not being submitted.  Should I add the 'accesskey' attribute? - I have seen that this may not be possible.  

Please help!
0
nickmarshall
Asked:
nickmarshall
1 Solution
 
joriszwaenepoelCommented:
Try setting the DefaultButton property of the Form in you aspx page.

<form id="Form1"
    defaultbutton="SubmitButton"
    defaultfocus="TextBox1"
    runat="server">
0
 
robastaCommented:
you can also setup the defaultbutton="SubmitButton" property on a Panel control that contains the form (if you have it)...
0
 
mohd_haqCommented:
Hi,
you could set the default button property at Page_Load event to the button you want. here is how you do it
 Page.Form.DefaultButton = btnSubmit.ID.ToString(); // change the name of the button to that of yours.

Hope this helps you.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now