Click here to Skip to main content
15,921,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi as everybody knows most of webdesign/coding is done in html/javascript so reduce the burden on server and where it is necessary/essential there only asp.net is used.
so i required a help friends.i want a short demo for eg i have a loging form where username and password are essentials . now i want to validate this feild`s using javascript . after proper validation is over i want to enter data in database using asp.net/c# codeing techniques . after that operation is over the database should return name of user or error depending upon operations. i want this result should be open in new window or in new tab o. please help me . sujjest me what steps should i carry out

thank u
anoop
Posted
Comments
anoop_vip 6-Nov-11 10:32am    
ok sorry guys i am replying late but i want both of action to happen on single click of button is possible. and i have gone through links thanks for your links/helps/suggestion

Hi, anoop

Still javascript is Rocking in the real time applications because of it's client side functionality.
In the real time when creating any form u need to do the client side verification's by using javascript or any script languages.

ex: To check whether the text box data is valid format or not. text box should not empty. When Click on Check box or Radio button enable or disable buttons this kind functionality is used in most scenario's if ur starter to the asp.net and c# u better to learn java script also.

try this link for learn basic javascript http://www.w3schools.com/js/default.asp[^]
 
Share this answer
 
Hi, anoop

Still javascript is Rocking in the real time applications because of it's client side functionality.
In the real time when creating any form u need to do the client side verification's by using javascript or any script languages.

ex: To check whether the text box data is valid format or not. text box should not empty. When Click on Check box or Radio button enable or disable buttons this kind functionality is used in most scenario's if ur starter to the asp.net and c# u better to learn java script also.

try this link for learn basic javascript http://www.w3schools.com/js/default.asp[^]
 
Share this answer
 
for Form validation check This[^]

For retrieving data Check This[^]

While Retrieving data check whether there exists a record with the username and password given in form
If exists then redirect to some welcome page and place the username in session so that You can use it in entire application.
If record not exists then show a popup saying username or password is wrong.
 
Share this answer
 
Comments
anoop_vip 6-Nov-11 10:33am    
thanks for links of javascript tutorial
To validate login fields use this javascript code

XML
<script language="javascript" type="text/javascript">

function Validation()
{
var userid=document.getElementById('<%=txtUserID.ClientID %>');
var pwd=document.getElementById('<%=txtPwd.ClientID %>');
if(userid.value=="")
{
alert("Please Enter UserID");
userid.focus();
return false;
}
if(pwd.value=="")
{
alert("Please Enter Password");
pwd.focus();
return false;
}
}
    </script>



To connect to database refer this link just for idea

http://geekswithblogs.net/dotNETvinz/archive/2009/04/30/creating-a-simple-registration-form-in-asp.net.aspx[^]


In your login.aspx.cs page write the following code
C#
protected void btnLogin_Click(object sender, EventArgs e)
    {

            string query = "SELECT USerID,Password WHERE UserID='" + txtUserID.Text + "' AND Password='" + txtPwd.Text + "' AND Active='True'";
            SqlDataAdapter da=new SqlDataAdapter(query,connectionstring);
            connectionstring.Open();
            DataSet ds = new DataSet();
            da.Fill(ds);
             connectionstring.Close();
            
            ds.Tables[0].TableName = "LoginDetails";
            if (ds.Tables["LoginDetails"].Rows.Count > 0)
            {
            }
            else
            {
             lblError.Text = "UserID or Password are Incorrect";
            }
}



This may give you some idea
 
Share this answer
 
v3

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