从这里的文档http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.layouttemplate.aspx我通过下面的布局模板定制了登录控制的用户界面
<LayoutTemplate>
<h3 class="login-title page-header">
<asp:Literal runat="server" ID="loginHeading" Text="Sign-in"></asp:Literal>
</h3>
<div class="clearfix">
<asp:Label runat="server" ID="lblUserName" Text="Username" AssociatedControlID="UserName"></asp:Label>
<div class="input">
<asp:TextBox runat="server" ID="UserName"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="rfvTxtUserName" ErrorMessage="Username is required"
ControlToValidate="UserName" Text="Username is required"></asp:RequiredFieldValidator>
</div>
</div>
<div class="clearfix">
<asp:Label runat="server" Text="Password" AssociatedControlID="Password"></asp:Label>
<div class="input">
<asp:TextBox runat="server" ID="Password" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="rfvTxtPassword" ErrorMessage="Password is required"
ControlToValidate="Password" Text="Password is required"></asp:RequiredFieldValidator>
</div>
</div>
<div class="clearfix">
<asp:Label runat="server" Text="Remember Me" AssociatedControlID="RememberMe"></asp:Label>
<div class="input">
<input type="checkbox" runat="server" id="RememberMe" />
</div>
</div>
<div class="actions action-fix">
<asp:Button runat="server" ID="Login" Text="Login" CssClass="btn success small" />
<input type="reset" class="btn small" value="reset" />
</div>
</LayoutTemplate>
正如您所见,我确实根据控件的要求命名了控件ID。我也使用CSS Friendly控件适配器来渲染Login控件。
只是在用户输入用户名和密码并提交详细信息后,页面才会重新加载导致回发。
信息:
对于使用LoginControlAdapter
的用户来说,更多问题似乎更加突出http://forums.asp.net/t/1043974.aspx/2/10
答案 0 :(得分:0)
尝试将命令名称添加到登录按钮;
<asp:Button runat="server" ID="Login" Text="Login" CssClass="btn success small" CommandName="Login" />
答案 1 :(得分:0)
你必须缺少CommandName参数
<asp:button id="Login" CommandName="Login" runat="server" Text="Login"></asp:button>