locked
Login Control in asp.net 4.0 with css!? RRS feed

  • Question

  • User645276720 posted

    hi, I am currently building a website in asp.net 4.0 mostly styling it with css to keep the asp controls at minimum, i want to create a login control with roles which is fine, but i do not know how to style it with css can anybody help please ?? =D

    Thursday, October 28, 2010 6:32 AM

Answers

  • User44080657 posted

    I know you said you were trying to keep the asp controls to a minimum, but in this case if its not broke...dont fix it. Use the login control and login templates to style the control the way you want. then you can apply your css classes where needed Like this

     

     

    <asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">

     

    <LayoutTemplate>

     

    <span class="failureNotification">

     

    <asp:Literal ID="FailureText" runat="server"></asp:Literal>

     

    </span>

     

     

    <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification" ValidationGroup="LoginUserValidationGroup"/>

     

    <div class="accountInfo">

     

    <fieldset class="login">

     

    <legend>Account Information</legend>

     

    <p>

     

    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>

     

    <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>

     

     

     

    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>

     

    </p>

     

    <p>

     

    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>

     

    <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>

     

     

     

    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>

     

    </p>

     

    <p>

     

    <asp:CheckBox ID="RememberMe" runat="server"/>

     

    <asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" CssClass="inline">Keep me logged in</asp:Label>

     

    </p>

     

    </fieldset>

     

    <p class="submitButton">

     

    <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>

     

    </p>

     

    </div>

     

    </LayoutTemplate>

     

    </asp:Login>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 28, 2010 12:11 PM