Help:How to avoid button click event when Enter key is press in a TextBox?

J

Jie

Hi, All,
I have a simple ASPX page that has one textbox, one linkbutton and one
button. When I enter something on the textbox and press ENTER key, the
button click event gets fired. What I want is the LinkButton click event
gets fired. I wrote a java script to fire the LinkButton Click event in the
onkeydown event of the textbox. But after the LinkButton click event is
fired, the Button Click event is also fired. Can anybody help me to suppress
the Button Click event in this situation? Thanks

Jie
 
J

Jie

Ken,
Thanks for the reply. I don't think we will use a free control in our
project. I am still looking for a way to fire the linkbutton click event. Do
you have any other suggestions? Thanks again.
 
G

Guest

The source code for that control is freely available, so you could adapt it
to your project quite easily without using the compiled version.
 
J

JG

Yes, I did it but it did not help. It did suppress the button click event
but it also suppress my key press that is the character I enter didd not
show up in the textbox. Thanks.
 
J

Jie

HI, Xavier,
It works when I use "javascript: return YourFunction();"
In the function YourFunction(), I can return true or false.
Thanks for help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top