Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Login control Layout template failuretext

I have a login control with the following markup:

<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>

The problem is, the FailureText is never shown, even when I enter a wrong username or password. It just reloads the page. Do I need to trigger this myself somehow? If I don't specify the LayoutTemplate, it shows the text as it should (although it renders with tons of tables :).

Thanks in advance! :)

like image 497
ManiSto Avatar asked Dec 27 '22 22:12

ManiSto


1 Answers

Hehe, I just found out that it isn't enough to just give the button an Id of "Login". The CommandName has to be set to "Login". I'm just leaving the solution here if anyone else should stumple upon this problem.

like image 142
ManiSto Avatar answered Jan 13 '23 10:01

ManiSto