473,666 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default button - pressing Enter

I have a form with 2 or more buttons. How do I control which one will
fire when I press the Enter key? In traditional ASP, I could create 2
or more forms, each with their own Submit buttons. Since there is only
one form, how do I control which of the submit buttons will fire?
Nov 18 '05 #1
3 1449
Hi Dan,

these URLs will help.

http://www.developer.com/net/asp/article.php/1594521
http://groups.google.com/groups?hl=e...readm=u%24MfvC
nrBHA.2072%40tk msftngp07&rnum= 2&prev=/groups%3Fq%3Dde fault%2Bbutton% 2BASP%2B
..NET%26ie%3DUT F-8%26oe%3DUTF-8%26hl%3Den
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

hope they help.

--
Cheers!
Rajiv. R
Rajspace.Org

"Dan Brussee" <db******@nc.rr .com> wrote in message
news:2g******** *************** *********@4ax.c om...
I have a form with 2 or more buttons. How do I control which one will
fire when I press the Enter key? In traditional ASP, I could create 2
or more forms, each with their own Submit buttons. Since there is only
one form, how do I control which of the submit buttons will fire?

Nov 18 '05 #2
Dan Brussee <db******@nc.rr .com> wrote in
news:2g******** *************** *********@4ax.c om:
I have a form with 2 or more buttons. How do I control which one will
fire when I press the Enter key? In traditional ASP, I could create 2
or more forms, each with their own Submit buttons. Since there is only
one form, how do I control which of the submit buttons will fire?


Use JS and capture the enter key. You can then tell it to do what you want.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
Nov 18 '05 #3
Max
Page.RegisterHi ddenField("__EV ENTTARGET", "bSearch")

in the Page_Load sub works

If this is in a user control, I've learned that you need to change the
"bSearch" to the NAME of the button as it is rendered on the page. So since
my button is actually inside a user control, I had to do:

Page.RegisterHi ddenField("__EV ENTTARGET", "WucPager1:bSea rch")

-Max
"Dan Brussee" <db******@nc.rr .com> wrote
I have a form with 2 or more buttons. How do I control which one will
fire when I press the Enter key? In traditional ASP, I could create 2
or more forms, each with their own Submit buttons. Since there is only
one form, how do I control which of the submit buttons will fire?


Nov 18 '05 #4

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

Similar topics

2
1592
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 processed - wrong. so, how to make a button default (when one presses ENTER then it's processed onClick event)? thanks, bj
2
1819
by: Ben Fidge | last post by:
Hi I'm writing a web application where the entire site is driven through a single page, and content is dynamically loaded using Web UserControls. This is achieved by using Page.LoadControl() from within the main page. My Login UserControl has a "Login" button and I want that to become the default button when the user presses .
1
1532
by: George Homorozeanu | last post by:
Hi, I have an ASP.Net Page with some control on it (buttons, textboxes, calender, etc). When I'm changing the text in the textbox I want to run some code and change the date of the calendar. The problem is that when I press enter, the code for the button event is called. It looks like the button is the default action for pressing enter somewhere on the page. How can I change that? The button is an asp button. Thanks,
12
7367
by: SJ | last post by:
Hope someone can help me out there I'm struggling with a particular problem... I have a form with many tab pages. On one tab page I've got a button which when clicked with a mouse adds items into a datagrid. When a user presses the enter key on this button I want the mouse click event to be activated but instead the tab page's validating event is called. I understand that this behaviour is by partly by design (Accept button etc) but I...
15
12531
by: simonoficina | last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button object has a property called "default" that can set this button like press "ENTER" key. But in the VB.net I can't find this property. Where is it? Or mabye change the other thing,No?Thanks ! Simon
1
4649
by: Joey | last post by:
I have an asp.net 1.1/C# web form with a text box server control and one button server control. Users can type in text to search and then click the button to start the search. I want them to be able to type in text and then just hit the Enter key instead of having to click the button. Currently, an Enter keypress causes a post back, but it does not fire the event handler for the button click. How can I get this to work?
6
2978
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I have an application that is designed for using with a bar code scanner. I want the user to know that the scan was complete and the data was entered, so I am playing a system sound after data entry. The data is being put into a text box, and a Return is sent after the data. I use the keypress event to capture the Return, and save the data. Then, I play the system sound, clear the text box, and set the focus back to the text box for the...
6
5079
by: Stanimir Stamenkov | last post by:
I have a form without a submit button like: <form name="form1" action="" onsubmit="alert('submit ' + this.name);"> <div> <label>Field 1: <input type="text" name="field1" onchange="alert(this.name + '=' + this.value);"></label></div> <label>Field 2: <input type="text" name="field2" onchange="alert(this.name + '=' + this.value);"></label></div> </form>
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8638
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7381
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.