Solved

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

Posted on 2010-09-23
3
494 Views
Last Modified: 2012-05-10
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
Comment
Question by:nickmarshall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
joriszwaenepoel earned 500 total points
ID: 33741714
Try setting the DefaultButton property of the Form in you aspx page.

<form id="Form1"
    defaultbutton="SubmitButton"
    defaultfocus="TextBox1"
    runat="server">
0
 
LVL 14

Expert Comment

by:robasta
ID: 33741851
you can also setup the defaultbutton="SubmitButton" property on a Panel control that contains the form (if you have it)...
0
 
LVL 6

Expert Comment

by:mohd_haq
ID: 33752367
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question