Default button - pressing Enter

  • Thread starter Thread starter Dan Brussee
  • Start date Start date
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?
 
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.
 
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
 
Back
Top