Thursday, September 13, 2007 page default button

It won't be a long post. I just want to add one more post to the internet about this issue.
I'd looked for it it some time ago and at the time found a solution which seemed just perfect, at least it worked perfect, or so I thought. But a few days ago, a coworker was using one my apps (Goomez) and showed some strange behavior. The default button was not working as it was supposed to, and when I tested on my machine it did. Of course, he was using Firefox, don't ask me why, I don't get people using Firefox :)

Bottom line is I found a very useful post by Scott Guthire about this issue, and pretty easy to implement. Just put your controls inside a panel. This panel has an attribute called defaultButton where as the value you have to write your button's name. And that's it.

  <asp:panel defaultbutton="btnSearch" runat="server">
<asp:Image ID="imageLogo" runat="server" ImageUrl="~/images/GoomezLogo2.gif" />
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="<%$ Resources:StringResources,search %>" OnClick="btnSearch_Click" />

Check out the original post for some other useful tips

P.S: I'm trying the "Insert from Visual Studio" plugin for Windows Live Writer

No comments: