how to create own login controls ?
so that it has 2 labels(say user name, password),2 textbox, 1 button
moreover how to verify the username , password in button event?
explain with some example!
i am a beginner
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Oct 14, 2009, 12:30 PM
here is Article about it written by some of our communities member :)
take a look how to create it using Visual Studio but logic will be same that i mentioned in above code
http://www.c-sharpcorner.com/UploadFile/cvinodkumar/LoginUserControl11232005011130AM/LoginUserControl.aspx
Roei BarPosted Oct 14, 2009, 11:46 AM
and Button WebControl ?
have a look @ the following
http://www.codeproject.com/KB/validation/textboxwithvalidator.aspx
and a very nice project
http://dj.codeplex.com/
its a set of controls based on Jquery and ASP.NET
Roei BarPosted Oct 14, 2009, 11:46 AM
and Button WebControl ?
have a look @ the following
http://www.codeproject.com/KB/validation/textboxwithvalidator.aspx
and a very nice project
http://dj.codeplex.com/
its a set of controls based on Jquery and ASP.NET
ganesh kumarPosted Oct 14, 2009, 11:38 AM
all i need is how to create a our own login controls,(like textbox, button, login as they are default controls in Visual studio 2008)..
hope u got me?
Kirtan PatelPosted Oct 14, 2009, 10:30 AM
Here is Code for Button's Click Event that you want :)
friend , dont forget to mark "do you like this answer" if answer helped you please :)
Here suppose we have One Table Users in Data base
------------------
| Users |
------------------
| Username |
| Password |
------------------
and you have Built the page Design Like Below Image
protected void btnLogin_Click(object sender, EventArgs e)
{
if (txtUsername.Text != "" && txtPassword.Text != "")
{
SqlConnection con = new SqlConnection("Connection String Here");
con.Open();
SqlCommand comm = new SqlCommand("select * from Users where username=@username and password=@password", con);
comm.Parameters.AddWithValue("@username", txtUsername.Text);
comm.Parameters.AddWithValue("@password", txtPassword.Text);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
con.Close();
if (dt.Rows.Count > 0)
{
//Login Success full
//Code To Redirect to Next Page After Successfull Login
// Add Username Password in Session if you want to also User it in Other page
Session["Username"] = txtUsername.Text;
Session["Password"] = txtPassword.Text;
}
else
{
Response.Write("Access Denied!! Tty Again!!");
}
}
else
{
Response.Write("Username or Password Cant be Blank !!");
}
}