Default Button in ASP.NET 2.0

by javery on February 9, 2006

I was looking around today for the best way to get default button behavior in ASP.NET 2.0, I was just about to use my favorite 1.1 solution (metabuilders defaultbuttons) when I stumbled upon this post by Scott Guthrie which shows that you can simply use the panel control like so:

<asp:panel defaultbutton=”btnOK” runat=”server”>

</asp:panel>

Sweet!

-James

{ 3 comments }

Mike February 9, 2006 at 1:33 pm

Very nice, I was looking for this same functionality, thanks for the post.

Jason Bock February 11, 2006 at 3:04 am

Just make sure you test this if/when you move to a web farm. We had nothing but problems with the generated code in WebResources.axd – we basically inlined the gen’d code:

http://www.jasonbock.net/JB/Default.aspx?blog=entry.53884fc667cf43e59cf77bd613f61740

Amir April 2, 2008 at 8:52 am

simply…. i love u for this smart tip.

Comments on this entry are closed.

Previous post: More Ask the Pros

Next post: New Blogs