ASP.NET 2.0 Login controls

Discussion in 'ASP.NET 2.0' started by jgs3, Oct 18, 2007.

  1. I am building a login page for my site. Posts I have read suggest that I can use the ValidationSummary control to display any error conditions traped.

    Out of th ebox the login control has the two fields (name, password) that have required field validators. Each is defined with a "*" string and an error message like "User name is required". My issue is nothing more that the "*" will ever display for the user if they do not supply an entry for either text boxes. The control group in the ValidationSummary contral is set to login1 to match the outof the box login control. I have been experimenting with EnableClientScripting property of the summary but that hasn't helped either.

    Any insight would be greatly appreciated. Thanks for your time.

    Regards,
    Jim
     
  2. Thanks for your reply and thoughts.


    That's the example I was going from when I coded. Username and password text boxes are assigned a validationgroup parameter of login1 as in:


    <td align="right">


    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label></td>


    <td>


    <asp:TextBox ID="UserName" runat="server" Font-Size="0.8em"></asp:TextBox>


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


    </td>


    </tr>


    <tr>


    <td align="right">


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


    <td>


    <asp:TextBox ID="Password" runat="server" Font-Size="0.8em" TextMode="Password"></asp:TextBox>


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


    </td>


    Now when I slap the validation summary into the page and make the assignment as described above, the resulting code is:


    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="Login1" />


    and I still don't get any error message other than the "*" when I don't supply either required parameter. Both the login and validationsummary are strait our of the box.


    Does this give anybody any ideas?
     
  3. I'd suggest a few things, one being your use of labels with associations.
    You should use asp.net literal controls for those instead.
    As for you grouping of the login validations, it seems you would benefit from watching this:
    http://asp.net/learn/videos/video-47.aspx

    The code samples on that page should help also.
     

Share This Page