views:

175

answers:

3

What is the best way to implement mutliple Default Buttons on a ASP.NET Webform?

I have what I think is a pretty standard page. There is a login area with user/pass field and a login button. Then elsewhere on the same page there is a single search field with a search button.

+1  A: 

Capture the enter key press for each area of the screen and then fire the corresponding button's click even.

Bloodhound
+1  A: 

Use a helper function like this one to tie the textboxes to their associated buttons.

Ian Nelson
+6  A: 

asp:Panel has a property named DefaultButton. You just need to encapsulate your markup portions with appropriate panels and set the default buttons for each.

cruster
What I had in mind, but implemented properly. Well done.
Raithlin