Solved

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

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

749 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