Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Sir,

I am using Membership in my page well when I call the textbox Id in the below function, The page never reconize the id.

my view: I have to find Control to passId of textbox in function
txtuserName and txtPassword both declared in Membership Template fields(Anonymous Template field)

Please help in Membership....


C#
protected void btnLogin_Click(object sender, EventArgs e)
{
    if (validData())
    {
        login();
    }
}

private void login()
{ 
    DataTable dtuser=new DataTable();
    try
    {
        dtuser = Login.GetLoginUserDetail(txtUserName.Text.Trim(),txtPassword.Text.Trim());
    }
    catch
    {
        
    }
        
    if (dtuser.Rows.Count>0)
    {
        string usertype = dtuser.Rows[0]["UserType"].ToString();
        if (usertype=="TL") // For TL
        {
            Session["USERID"] = dtuser.Rows[0]["UserID"].ToString();
            Session["USERTYPE"] = dtuser.Rows[0]["UserType"].ToString();
            Session["USERLOGINNAME"] = dtuser.Rows[0]["employeename"].ToString();
            Session["EMPLOYEEID"] = dtuser.Rows[0]["empid"].ToString();
            Response.Redirect("~/TL/frmTLHome.aspx");
               
        }
    }
    else
    {
        Messagebox1.Show("Invalid Username or Password!");
    }
}
Posted
Updated 17-Jan-12 1:36am
v2
Comments
BobJanova 17-Jan-12 7:38am    
Unclear - there is no reference to Id or anything like it in the posted function.
Jephunneh Malazarte 18-Jan-12 5:26am    
ey prashant are you talking about the txtUserName and the txtPassword?
if you don't have it in aspx page and you didn't declare those somewhere then that's an absolute error.

don't use try..catch like when ever you want it.. cheers.. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900