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
Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

790 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