Login page problem

Total Post:110

Points:774
 1022  View(s)
Ratings:
Rate this:

I have created this login page.

      <asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 112px; POSITION: absolute; TOP: 112px" runat="server">Password</asp:Label>
        <asp:TextBox id="txtLogin" style="Z-INDEX: 109; LEFT: 192px; POSITION: absolute; TOP: 56px" runat="server"
            Width="152px"></asp:TextBox>
        <asp:TextBox id="txtPassword" style="Z-INDEX: 102; LEFT: 192px; POSITION: absolute; TOP: 104px"
            runat="server" TextMode="Password" Width="152px"></asp:TextBox>
        <asp:Label id="Label1" style="Z-INDEX: 100; LEFT: 112px; POSITION: absolute; TOP: 56px" runat="server">Login</asp:Label>
        <asp:RequiredFieldValidator id="RequiredFieldValidator1" style="Z-INDEX: 104; LEFT: 368px; POSITION: absolute; TOP: 64px"
            runat="server" ErrorMessage="Please enter Login Name" ControlToValidate="txtLogin" Width="153" Height="19"></asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator id="RequiredFieldValidator2" style="Z-INDEX: 105; LEFT: 368px; POSITION: absolute; TOP: 104px"
            runat="server" ErrorMessage="Please enter password" ControlToValidate="txtPassword" Width="153px" Height="19px"></asp:RequiredFieldValidator>
        <asp:Button id="btnLogin" style="Z-INDEX: 106; LEFT: 216px; POSITION: absolute; TOP: 168px"
            runat="server" Width="72px" Text="Sign In" Height="24px" onclick="btnLogin_Click"></asp:Button>
 
        <asp:Label id="LabelError" style="Z-INDEX: 107; LEFT: 176px; POSITION: absolute; TOP: 272px"
            runat="server" Width="456px" Height="48px" Font-Bold="True" Font-Size="Medium"
            ForeColor="#0000C0"></</asp:Label>
                    <asp:Button ID="Button1" style="Z-INDEX: 106; LEFT: 300px; POSITION: absolute; TOP: 168px"
            runat="server" Width="72px" Text="New User" Height="24px" onclick="Button1_Click"/>
Everything is ok except the button New User. I would like when press it then to send me in another page NewUser.aspx.I write this code in button click
 
protected void Button1_Click(object sender, EventArgs e)
{
    Response.Redirect("NewUser.aspx");
}

but when i press the button then the validations(which i use them to sign in) tell me to give login name and password which i don't want. How can i do this?

  1. Post:378

    Points:2694
    Re: Login page problem

    Hi Jayden, 


    This can be controlled with the ValidationGroup property. Set the ValidationGroup property on btnLogin and on your validators and that should do the trick.

Answer