Solved

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

Posted on 2010-09-23
3
488 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
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

760 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now