I am on vb.net 4.0. I want to press enter to submit my login form. However, I cannot set the btnLogin as default button for submitting my login form. As I use the login page from masterpage template, I set the default button property in contentplaceholder tag but doesn't work. Try to set in the form of masterpage also doesn't work. Should I try other method? or Javascript?
问问题
1627 次
2 回答
0
You need to add the defaultbutton
attribute to your form
tag
<form id="form1" runat="server" defaultbutton="btnLogin">
</form>
于 2012-07-04T09:55:44.187 回答
0
Put a panel around the login form and set the default button on there
<asp:Panel runat="server" id="pnlLogin" DefaultButton="btnLogin">
<asp:Label runat="server" id="lblUsername" Text="Username:" AssociatedControlID="txtUsername" />
<asp:TextBox runat="server" id="txtUsername" />
<asp:Label runat="server" id="lblPassword" Text="Password:" AssociatedControlID="txtPassword" />
<asp:TextBox runat="server" id="txtPassword" TextMode="Password" />
<asp:Button runat="server" id="btnLogin" Text="Login" />
</asp:Panel>
Something along those lines.
于 2012-07-04T14:34:39.220 回答