Default button - pressing Enter

D

Dan Brussee

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?
 
C

Chad Z. Hower aka Kudzu

Dan Brussee said:
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.
 
M

Max

Page.RegisterHiddenField("__EVENTTARGET", "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.RegisterHiddenField("__EVENTTARGET", "WucPager1:bSearch")

-Max
 

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