473,386 Members | 1,609 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,386 software developers and data experts.

How to control enter button on the client PC in ASP.Net

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 does not have a submit button
then the button that was first placed on the form at
design time is fired and I do not want that to happen. Is
there any way to control enter button behaviour?
Many thanks
Simon
Nov 17 '05 #1
1 1415
You can intercept the client side enter keypress event of the text box and
then click the correct button using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx
And here's a good article on the subject:
http://www.allasp.net/enterkey.aspx

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Simon Fainveits" <sf********@rtg.com.au> wrote in message
news:02****************************@phx.gbl...
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 does not have a submit button
then the button that was first placed on the form at
design time is fired and I do not want that to happen. Is
there any way to control enter button behaviour?
Many thanks
Simon

Nov 17 '05 #2

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

Similar topics

5
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter...
3
by: Mike | last post by:
I'm trying to have a form where a user has to enter a valid email address, and I'm trying to use the RegEx Validation control to do that. The problem is that when a user submits the form with a...
7
by: Al Smith | last post by:
Newbee to aspx needs direction. We are using an <INPUT type="file" tag to upload a file. We also have a text field for the user to enter a description for the file which the user must enter. ...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
7
by: djc | last post by:
I noticed that after entering text into a textbox on an asp.net webform and then hitting the enter key that a postback appears to be performed. 1) what event can I write to in order to perform an...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
1
by: Tyler Carver | last post by:
I'm using the Layout Template for the Login Control. I've included all the neccessary controls on the page and everything is working nicely except hitting the enter key on any of the textboxes...
4
by: sowencheung | last post by:
Hi, all The scenario is like this: I have a master page, contains two user controls, one is a search control, another is a login control. The server-side <form> is in the master page,...
7
by: Christian Cambier | last post by:
Hi, I have a textbox in a web user control. I then add the usercontrol to a web form. I also add a label in the web form. Now, when I press a key in the textbox, i want to display some text...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.