473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to change default ENTER key behaviour on a button/form

On my current form, when I hit the enter key in a texbox, the form appears
to resubmit itself, but it's not actually doing a submit (or so I think?).
I would like to have the enter button fire the logic I have for the button.
In other words, I would like to have a default button for the form, is this
making sense?

I thought I saw on Fritz Onion's MSDN webcasts there is a way to assign a
default button to a form/page, is this in fact possible?

I'm sorry, I'm new to c# (and loving it much more than jsps! :>). Thanks
for any help.
Nov 18 '05 #1
2 8082
By default ASP.Net will press the first button in the tab order on the
page. If you want to change that behavior so that you get to pick the
button that is "clicked" when you hit enter then take a look at the
conversation here:

http://www.experts-exchange.com/Prog..._20944907.html

You should also be able to use that to determine how to modify
clientside behavior as well. Hope that helps.

Have A Better One!

John M Deal, MCP
Necessity Software

Flip wrote:
On my current form, when I hit the enter key in a texbox, the form appears
to resubmit itself, but it's not actually doing a submit (or so I think?).
I would like to have the enter button fire the logic I have for the button.
In other words, I would like to have a default button for the form, is this
making sense?

I thought I saw on Fritz Onion's MSDN webcasts there is a way to assign a
default button to a form/page, is this in fact possible?

I'm sorry, I'm new to c# (and loving it much more than jsps! :>). Thanks
for any help.

Nov 18 '05 #2
Check out this article,
http://www.allasp.net/enterkey.aspx

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Flip" <[remove]ph******@hotmail.com> wrote in message
news:#k**************@TK2MSFTNGP14.phx.gbl...
On my current form, when I hit the enter key in a texbox, the form appears
to resubmit itself, but it's not actually doing a submit (or so I think?).
I would like to have the enter button fire the logic I have for the button. In other words, I would like to have a default button for the form, is this making sense?

I thought I saw on Fritz Onion's MSDN webcasts there is a way to assign a
default button to a form/page, is this in fact possible?

I'm sorry, I'm new to c# (and loving it much more than jsps! :>). Thanks
for any help.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Billy Jacobs | last post by:
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...
6
by: CJM | last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter> key is pressed? As I understood it, if you have a form with a single submit button, if enter is pressed, the form...
7
by: Derrick | last post by:
Didn't there used to be some property where you could set a button to be the "default" so that if a user pressed enter with any control in focus, the button would still get the click event? Some...
1
by: Simon Fainveits | last post by:
Does anybody know how to control enter button on the web form? It seems to if the user hits enter button at run time then it fires submit button click event. I have also noticed that if the page...
2
by: Bratislav Jevtic | last post by:
hi, how to make some push button default on the form? for instance, I've got 2 buttons (Submit, Cancel). submit is on the left, cancel on the right side. on enter key pressed, cancel button is...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
4
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi peeps I'm trying to change the default postback of my webpage. I'm trying to create a searchbox where you can just press enter and it goes to the search results (ala apple.com *ahem* :o) ...
5
by: sivakumarcse | last post by:
I have some buttons in grid which is used to open a model popup(inside grid) . I included Form.DefaultButton = SaveBtn.UniqueId in my code. Finally i have a save button(default btn) to save the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.