Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2006, 08:37 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default Multiple Forms and the Return Key Focus

Hi All

I have a great question...

I have and asp.net page which consists of 2 separate functions

(1)search function - consists of textbox and a button
(2)contact form - consists of a couple of textboxes and a button

Is there a way I can make it so that if the user is filling in the search textbox and then press the Return key it submits the search button and vice versa, if they are completing the contact form and press Return, it submits the contact form button?

In the old days separate form tags used to acheive this but as both functions are within the same set of form tags this isn't available.

Many thanks in advance

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
 
Old June 20th, 2006, 11:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Try this: http://www.beansoftware.com/ASP.NET-...Enter-Key.aspx

Brian
 
Old June 20th, 2006, 12:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In addition to what Brian posted, you may also want to take a look at the DefaultButton property of an ASP.NET page or Panel.

Basically, you could wrap your two "forms" into two ASP:Panels instead, and set the DefaultButton property of each panel to the appropriate button.

Take a look here for some inspiration:

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=374

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old June 20th, 2006, 01:38 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Thank you very much both of you. Spot on!

Rit

Off to watch England beat Sweden :-)
 
Old June 20th, 2006, 01:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome. Have fun!!

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
capture return key in keydown event kawak_zx7 .NET Framework 1.x 1 April 23rd, 2007 11:21 AM
Return Primary Key of Last Append Query mselkregg Access 1 November 16th, 2006 11:36 AM
return key based navigation VB 6.0 madhukp VB How-To 3 October 6th, 2004 04:32 AM
Switch Focus between 2 Forms lxu Access 1 March 11th, 2004 09:49 AM
Button Focus and Enter Key nigel VS.NET 2002/2003 1 August 19th, 2003 07:41 AM





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