• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

In ASP.NET (not v2.0) Fire a Default Button when ENTER key is pressed



I have several pages within a web application I have developed.  A problem I have is with the default key that fires when the user presses the ENTER key instead of either the SAVE or SUBMIT or OK key.  I have read through some of the previous questions on this issue and this one (below) suggests to make all other buttons on the page except the one you want to be the default for the ENTER key to be INPUT TYPE="button" and to make the one that needs to be the default button to be INPUT TYPE="submit".

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21712452.html 
 
The buttons I have on my pages are ALL <asp:buttons> and when the page is rendered I see (in View/Source) that all the buttons are rendered as INPUT TYPE="submit"..

My question is how do I force an <asp:button> to render as INPUT TYPE="button"

All I am trying to do is to allow the user to have the choice of using the ENTER button or the SUBMIT button to submit the page to the server.

Any help will be great...thanks.msyed1.
0
msyed1
Asked:
msyed1
2 Solutions
 
Hamed ZaghaghiProgrammerCommented:
I use a submit button with width="0"

but in firefox the button can be seen,

see
http://edari.koaj.ir

I use a submit button for login
0
 
Bob LearnedCommented:
You have to change them from asp:button to <input> yourself, AFAIK.

Bob
0
 
msyed1Author Commented:
TheLearnedOne, you mean at run time (programatically) or at design time itself ??
0
 
Bob LearnedCommented:
At design time itself.

Bob
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
You should check out this control.

http://www.metabuilders.com/Tools/DefaultButtons.aspx

Ben.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now