protected void login_Click(object sender, EventArgs e) { string Name = name.Text; string Password = password.Text; CheckDuringLogin cdl = new CheckDuringLogin(); if (cdl.LoginData(Name, Password) == true) { Session["EmailId"] = name.Text; DataTable dt = cdl.Login(Name); if (dt.Rows.Count > 0) { Response.Redirect("ViewOrUpdate.aspx"); } else { Response.Redirect("EnterDetails.aspx"); } } else if (name.Text == "" && password.Text == "" || name.Text == "" || password.Text == "") { Label3.Text = "Please enter both the fields "; } else if (name.Text == "admin" && password.Text == "itsasecret") { Response.Redirect("RegisteredUsers.aspx"); } else { Label3.Text = "Invaild username and/or password or Click on SignUp to register "; } }
protected void Page_Load(object sender, EventArgs e) { this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None; if (Session["EmailId"] != null) { Email.Text = "" + Session["EmailId"]; } if (!IsPostBack) { string emailid = Email.Text; CheckDuringLogin cdl = new CheckDuringLogin(); DataTable dt = cdl.Login(emailid); UserI.Text = dt.Rows[0]["UserId"].ToString(); FirstName.Text = dt.Rows[0]["FirstName"].ToString(); LastName.Text = dt.Rows[0]["LastName"].ToString(); PhoneNumber.Text = dt.Rows[0]["PhoneNumber"].ToString(); PhoneNumber.Text = dt.Rows[0]["PhoneNumber"].ToString(); Address.Text = dt.Rows[0]["Address"].ToString(); City.Text = dt.Rows[0]["City"].ToString(); State.Text = dt.Rows[0]["State"].ToString(); Country.Text = dt.Rows[0]["Country"].ToString(); Department.Text = dt.Rows[0]["Department"].ToString(); Gender.Text = dt.Rows[0]["Gender"].ToString(); TenthBoard.Text = dt.Rows[0]["TenthBoard"].ToString(); TenthMarks.Text = dt.Rows[0]["TenthMarks"].ToString(); TwelfthBoard.Text = dt.Rows[0]["TwelfthBoard"].ToString(); TwelfthMarks.Text = dt.Rows[0]["TwelfthMarks"].ToString(); dt.Clear(); } }
private void BindGrid() { string Name = Convert.ToString(Session["EmailId"]); CheckDuringLogin cdl = new CheckDuringLogin(); DataTable dt = cdl.Login(Name); //data.DataSource = dt; //data.DataBind(); GridView1.DataSource = dt; GridView1.DataBind(); }