469,645 Members | 1,393 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Set Default Button on Web Form

Is there a way to make a button on a web form the default
button so that when the user hits the enter button the
code for that button executes?

I have a web page Login.aspx where I have only 1 button on
the form. When the user hits enter the button is clicked.

I have a second page mycsepp.aspx which has an asp button
and a link button. When I hit enter neither of the button
click events are triggered. If I tab to one of them and
press enter then it works.

I want the asp button to be the default. Is this possible
and if so how?
Jul 21 '05 #1
1 6169

Hi Billy,

You can handle the keydown event in the body scope and
response to the enter key.(keycode==13)
For more information and sample, you can visit:
http://www.net-language.com/CodeExample.aspx?i=596

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Billy Jacobs" <bi********@csa.com>
| Sender: "Billy Jacobs" <bi********@csa.com>
| Subject: Set Default Button on Web Form
| Date: Fri, 19 Sep 2003 08:18:14 -0700
| Lines: 14
| Message-ID: <01****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcN+wT6txPlVmbH/RI62XB9ABTHF9A==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.general
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:109186
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Is there a way to make a button on a web form the default
| button so that when the user hits the enter button the
| code for that button executes?
|
| I have a web page Login.aspx where I have only 1 button on
| the form. When the user hits enter the button is clicked.
|
| I have a second page mycsepp.aspx which has an asp button
| and a link button. When I hit enter neither of the button
| click events are triggered. If I tab to one of them and
| press enter then it works.
|
| I want the asp button to be the default. Is this possible
| and if so how?
|

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Billy Jacobs | last post: by
10 posts views Thread by cj | last post: by
1 post views Thread by andyrich_1 | last post: by
3 posts views Thread by Anil Kumar Sharma | last post: by
2 posts views Thread by Dave | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.