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

Enter Key triggers onClick event

37
Hello

I have designed a control that consists of a textarea and a button. When the user writes text in the textarea and the Enter key is pressed then the onClick event of the button is triggered. Is there any way I can make the Enter key not trigger the onClick event of the button. Or in the buttonclicked event handler to determine if the button was clicked or the enter was pressed?

Any help would be very appreciated
Thanks in advance
Sep 29 '08 #1
3 3365
iam_clint
1,208 Expert 1GB
what exactly are you trying to do here... you may want to go with onfocus().... you can also check if the charcode pressed was 14
Sep 29 '08 #2
Dreea
37
what exactly are you trying to do here... you may want to go with onfocus().... you can also check if the charcode pressed was 14
I don't want the enter key to trigger _btn_Click
Expand|Select|Wrap|Line Numbers
  1.        void _btn_Click(object sender, EventArgs e)
  2.         {
  3.             .....
  4.         }   
  5.  
where exactly i get the charcode pressed? I need to mention that the textbox is actually a gaia control so I don't have access to its code to add a keyPressed event handler
Sep 29 '08 #3
Frinavale
9,735 Expert Mod 8TB
I don't want the enter key to trigger _btn_Click
Expand|Select|Wrap|Line Numbers
  1.        void _btn_Click(object sender, EventArgs e)
  2.         {
  3.             .....
  4.         }   
  5.  
where exactly i get the charcode pressed? I need to mention that the textbox is actually a gaia control so I don't have access to its code to add a keyPressed event handler
I would recommend asking the people who created the control how to prevent this from happening. If it was a regular text area you would not be experiencing this problem.

-Frinny
Sep 29 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Alan Zhong | last post by:
i am trying to similate an "ENTER" as a key to switch focus in a sequence of text inputs. i don't want to use "event.keyCode" since i want to do additional testing before i decide which text input...
1
by: Matt | last post by:
<input type="button" onClick="doSomething()"> When the user click HTML button, it will launch doSomething(). But I want the user enter ENTER key, it will have same effect. Please advise....
7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
1
by: Lars Netzel | last post by:
I really need to stop users from reposting the form with Enter or Return keys. It bypasses so many onClick validations that nothign works if they use Enter. I must force the user to CLICK on the...
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
11
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and...
1
by: Dabbler | last post by:
I have a GridView which triggers the SelectedIndexChanging event when I click on the row anywhere implemented by this code in RowDataBound event handler: if ( e.Row.RowType ==...
3
by: Jake Barnes | last post by:
I'm researching the Enter key. This is for an Ajax chat application. The designer tells me that she wants people to be able to submit text simply by hitting the Enter key. She wants this to happen...
10
by: art | last post by:
Hi, I have a form with an image button like this: <td><input type='text' name='search' id='search' value='' size=30><BR><span class=body><center>Enter Email Address</span><BR></ td> <td><a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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 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.