Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 8th, 2007, 04:42 AM
Authorized User
Join Date: Jan 2007
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default on keypress (enter) jump to button

hi guys,ur help is needed yet another time.I have an asp.net webform in which the user can search.I want to apply something to directly jump to the search button when the user enters any criteria...ur help is appreciated

  #2 (permalink)  
Old January 8th, 2007, 09:37 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

I use a similiar function, however, it prevents a user from pressing the enter button and having it submit a form.

function keyPress(e)
    var pressedKey = document.all? window.event.keyCode:e.which;
    return pressedKey != 13;
document.onkeypress = keyPressed;
if (document.layers) document.captureEvents(Event.KEYPRESS);

What this does is if the numerical representation of the pressed key is 13 (Key code for the enter button) it is disregarded and thus the enter button press do not do anything on the page this function is implemented on.

To do what you want, you would alter the above function so that if the keycode is 13 you would call .focus on a form element.


I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Enter to jump to the next text field dimeanel Visual Basic 2005 Basics 2 April 29th, 2007 01:25 AM
how to use 'Enter' button to trigger a button, thx raybristol ASP.NET 1.0 and 1.1 Basics 1 December 16th, 2005 06:56 AM
Enter key vs Click Button akibaMaila VB.NET 2002/2003 Basics 1 January 14th, 2005 12:49 PM
VB.NET Datagrid Keypress using Enter jun VS.NET 2002/2003 0 April 5th, 2004 02:38 AM
Datagrid Keypress Enter jun VS.NET 2002/2003 0 April 5th, 2004 02:34 AM

All times are GMT -4. The time now is 12:29 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.