By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Enter Key triggers onClick event

P: 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
Share this Question
Share on Google+
3 Replies


iam_clint
Expert 100+
P: 1,208
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

P: 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
Expert Mod 5K+
P: 9,731
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

Post your reply

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