Wednesday, January 19, 2011

Best way to implement mutliple Default Buttons on a ASP.NET Webform

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.

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

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

    From Ian Nelson
  • 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.

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

0 comments:

Post a Comment