As I've mentioned a couple of times in the last few minutes(!), I've got a
simple form with an edit box and a Submit button. If I type something in
the Edit box and hit Enter I hear a click but nothing happens. If I click
on the Submit button its Click event fires as I'd expect. If I click
anywhere else on the web page and then hit Enter, the button's Click event
fires too.
I want the Click event to fire when the user is in the Edit box and hits
Enter. How can I do this?
Thanks for your help.
Nate Hekman
Calgary, Alberta, Canada 9 1863
Is it single line or multiline? If it's multiline it's by design.
You can use clientside code to catch the ENTER press event and call the
button click.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Nate Hekman" <he*********************@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
You can use some javascript to manage it. Add the javascript using the attributes of the control
TextBox1.Attributes.Add("onkeydown", "javascript :if((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)){document.Form1." & Button1.ClientID & ".click();return false;}else return true;")
(check the name of your HTML form and your controls to get this code to work)
Hope this helps
Alan Ferrandiz [MCT]
"Curt_C [MVP]" <software_AT_darkfalz.com> escribió en el mensaje news:#u**************@TK2MSFTNGP10.phx.gbl... Is it single line or multiline? If it's multiline it's by design. You can use clientside code to catch the ENTER press event and call the button click. -- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com "Nate Hekman" <he*********************@nospam.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
It's single line. And it does reload the page--I can put a breakpoint in
Page_Load and it breaks when I hit Enter, but it doesn't call
btnSubmit_Click.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Is it single line or multiline? If it's multiline it's by design. You can use clientside code to catch the ENTER press event and call the button click.
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"Nate Hekman" <he*********************@nospam.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
Hello Nate,
I have a post on my website which details how to fix this without any complex javascript, etc. http://www.mattberther.com/2003/06/000125.html
--
Matt Berther http://www.mattberther.com As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
of course not... you didn't call it. You'll have to do some if(IsPostBack)
in the load_page and call the function(s) that are in the button_click
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Nate Hekman" <he*********************@nospam.com> wrote in message
news:uD**************@TK2MSFTNGP12.phx.gbl... It's single line. And it does reload the page--I can put a breakpoint in Page_Load and it breaks when I hit Enter, but it doesn't call btnSubmit_Click.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Is it single line or multiline? If it's multiline it's by design. You can use clientside code to catch the ENTER press event and call the button click.
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"Nate Hekman" <he*********************@nospam.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
Hello Curt_C [MVP]" software_AT_darkfalz.com,
Whoah... No you dont... The event needs to be hooked up and it will be executed somewhere between OnInit and OnLoad...
--
Matt Berther http://www.mattberther.com of course not... you didn't call it. You'll have to do some if(IsPostBack) in the load_page and call the function(s) that are in the button_click
"Nate Hekman" <he*********************@nospam.com> wrote in message news:uD**************@TK2MSFTNGP12.phx.gbl...
It's single line. And it does reload the page--I can put a breakpoint in Page_Load and it breaks when I hit Enter, but it doesn't call btnSubmit_Click.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it single line or multiline? If it's multiline it's by design. You can use clientside code to catch the ENTER press event and call the button click. -- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com "Nate Hekman" <he*********************@nospam.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
Well that starts to get pretty messy pretty fast, because of course if you
DO click the button then first Page_Load gets called, followed by
btnSubmit_Click. If you also call btnSubmit_Click from Page_Load, it gets
called twice.
Matt Berther's fix did the trick for me. Thanks to everyone who offered
advice.
Nate
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl... of course not... you didn't call it. You'll have to do some if(IsPostBack) in the load_page and call the function(s) that are in the button_click
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"Nate Hekman" <he*********************@nospam.com> wrote in message news:uD**************@TK2MSFTNGP12.phx.gbl... It's single line. And it does reload the page--I can put a breakpoint in Page_Load and it breaks when I hit Enter, but it doesn't call btnSubmit_Click.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Is it single line or multiline? If it's multiline it's by design. You can use clientside code to catch the ENTER press event and call the button click.
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"Nate Hekman" <he*********************@nospam.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but nothing happens. If I click on the Submit button its Click event fires as I'd expect. If I click anywhere else on the web page and then hit Enter, the button's Click event fires too.
I want the Click event to fire when the user is in the Edit box and hits Enter. How can I do this?
Thanks for your help.
Nate Hekman Calgary, Alberta, Canada
I didn't specifically mean it could ONLY be from the load, just trying to
say that he needed to put in a catch in the load sequence.....geesh....
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Matt Berther" <mb******@hotmail.com> wrote in message
news:em*************@tk2msftngp13.phx.gbl... Hello Curt_C [MVP]" software_AT_darkfalz.com,
Whoah... No you dont... The event needs to be hooked up and it will be executed somewhere between OnInit and OnLoad...
-- Matt Berther http://www.mattberther.com
of course not... you didn't call it. You'll have to do some if(IsPostBack) in the load_page and call the function(s) that are in the button_click
"Nate Hekman" <he*********************@nospam.com> wrote in message news:uD**************@TK2MSFTNGP12.phx.gbl...
It's single line. And it does reload the page--I can put a breakpoint in Page_Load and it breaks when I hit Enter, but it doesn't call btnSubmit_Click.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it single line or multiline? If it's multiline it's by design. You can use clientside code to catch the ENTER press event and call the button click. -- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com "Nate Hekman" <he*********************@nospam.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
> As I've mentioned a couple of times in the last few minutes(!), > I've got a simple form with an edit box and a Submit button. If I > type something in the Edit box and hit Enter I hear a click but > nothing happens. If I click on the Submit button its Click event > fires as I'd expect. If I click anywhere else on the web page and > then hit Enter, the button's Click event fires too. > > I want the Click event to fire when the user is in the Edit box and > hits Enter. How can I do this? > > Thanks for your help. > > Nate Hekman > Calgary, Alberta, Canada
Hello Curt_C [MVP]" software_AT_darkfalz.com,
I suppose I misunderstood... I thought you meant he needed to do something like this:
private void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
Button_Click(submitButton, EventArgs.Empty);
}
}
which, of course, is completely wrong...
--
Matt Berther http://www.mattberther.com I didn't specifically mean it could ONLY be from the load, just trying to say that he needed to put in a catch in the load sequence.....geesh....
"Matt Berther" <mb******@hotmail.com> wrote in message news:em*************@tk2msftngp13.phx.gbl...
Hello Curt_C [MVP]" software_AT_darkfalz.com,
Whoah... No you dont... The event needs to be hooked up and it will be executed somewhere between OnInit and OnLoad...
-- Matt Berther http://www.mattberther.com of course not... you didn't call it. You'll have to do some if(IsPostBack) in the load_page and call the function(s) that are in the button_click
"Nate Hekman" <he*********************@nospam.com> wrote in message news:uD**************@TK2MSFTNGP12.phx.gbl...
It's single line. And it does reload the page--I can put a breakpoint in Page_Load and it breaks when I hit Enter, but it doesn't call btnSubmit_Click.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
> Is it single line or multiline? If it's multiline it's by design. > You can use clientside code to catch the ENTER press event and > call > the > button click. > -- > Curt Christianson > Owner/Lead Developer, DF-Software > Site: http://www.Darkfalz.com > Blog: http://blog.Darkfalz.com > "Nate Hekman" <he*********************@nospam.com> wrote in > message > news:%2****************@TK2MSFTNGP14.phx.gbl... >> As I've mentioned a couple of times in the last few minutes(!), >> I've got a simple form with an edit box and a Submit button. If >> I type something in the Edit box and hit Enter I hear a click >> but nothing happens. If I click on the Submit button its Click >> event fires as I'd expect. If I click anywhere else on the web >> page and then hit Enter, the button's Click event fires too. >> >> I want the Click event to fire when the user is in the Edit box >> and hits Enter. How can I do this? >> >> Thanks for your help. >> >> Nate Hekman >> Calgary, Alberta, Canada This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Deano |
last post by:
I think that just about sums it up. Is there a fix/workaround for this?It's
quite annoying behaviour and not user-friendly.thanksMartin
|
by: 23s |
last post by:
My site's login page has a form w/ 2 textboxes and a submit button. If I'm
in either of those textboxes (i.e., either one of the textboxes has focus),
in any given browser, hitting "enter" on my...
|
by: PJ6 |
last post by:
I want to be able to, depending on the state of the page, direct what the
ENTER key causes the page to do.
The problem I'm having is I have a user control with a textbox and an
"enter" button....
|
by: TS |
last post by:
for some reason, it posts to the server, but no click events of any buttons
on form fire. the button is the first one on the form. when the focus is
inside the textbox, it doesnt' work. if i click...
|
by: Dundealing |
last post by:
I have a single button on my form, and when I press the Enter key while a
TextBox has focus I want the Button.Click event to fire.
Is there a simple way to do this ?
|
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,...
|
by: gferreri |
last post by:
Hi all,
I've stumbled on an interesting problem with the way Firefox handles
form submitting with the enter key.
I'm putting together a page that has one form element with multiple
controls...
|
by: id10t error |
last post by:
I have a program where were are scanning bar codes for a scanner
hooked up to a laptop via USB. The scanner adds the CRLF at the end
of
every scan. I need to figure out how to make the program to...
|
by: Sunfire |
last post by:
I was wondering if there was a way to hit enter to insert blank lines while
in the designer? I tried this but all it seems to want to do is insert code
that really shouldn't be there. For example,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |