Set Default Button on Web Form

  • Thread starter Thread starter Billy Jacobs
  • Start date Start date
B

Billy Jacobs

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?
 
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" <[email protected]>
| Sender: "Billy Jacobs" <[email protected]>
| Subject: Set Default Button on Web Form
| Date: Fri, 19 Sep 2003 08:18:14 -0700
| Lines: 14
| Message-ID: <[email protected]>
| 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?
|
 
Back
Top