I have 3 buttons in a form. One of them is the submit button. How can I make it the default button to be clicked when I press the enter key. Is there a property for this?
From stackoverflow
-
There is a property for the form: defaultbutton.
<form runat="server" defaultbutton="myButton"> ... </form>It is first time implemented in ASP.NET 2.0.
-
Or you can do it in code - Page_load:
Page.Form.DefaultButton = btnSearch.UniqueID;Whenever you press enter the btnSerach control will be used as default.
-
Another helpful tip is that you can set the default button on asp:panel's too.
Iain M Norman : Thank you. Thank you. Thank you. It's been a horrific morning of debugging and now I'd like to have your children!qui : Sounds painful :)Matthew Doyle : Wow, this saved me a ton of time. Thanks!
0 comments:
Post a Comment