2011-04-10 41 views
5

我有以下标记的登录控制:ASP.NET登录控件布局模板failuretext

<asp:Login ID="ScrapLogin" runat="server" FailureText="Brugeren findes ikke eller adgangskoden er forkert!" RenderOuterTable="false"> 
<LayoutTemplate> 
    <ul class="form"> 
     <li> 
      <asp:Label AssociatedControlID="UserName" runat="server" Text="Brugernavn:" /> 
      <asp:TextBox ID="UserName" runat="server" /> 
     </li> 
     <li> 
      <asp:Label AssociatedControlID="Password" runat="server" Text="Password:" /> 
      <asp:TextBox ID="Password" runat="server" TextMode="Password" /> 
     </li> 
    </ul> 
    <asp:Button ID="Login" runat="server" Text="Log ind!" /> 
    *<asp:Literal ID="FailureText" runat="server" EnableViewState="false" />* 
</LayoutTemplate> 

的问题是,在FailureText从未显示,甚至当我输入错误的用户名或密码。它只是重新加载页面。我需要自己触发这个吗?如果我没有指定LayoutTemplate,它将显示文本(尽管它使用大量表格呈现:)。

在此先感谢! :)

回答

10

嘿嘿,我刚刚发现,只是给按钮“登录”的ID是不够的。 CommandName必须设置为“登录”。如果有其他人应该解决这个问题,我只是将解决方案留在这里。

+0

谢谢!!!!!!!!!!!!!!!!!! :) – tommed 2014-04-17 10:11:27