how to apply javascript to asp.net control ?
expalin with examplee..
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.
Satyapriya NayakPosted Mar 13, 2013, 12:37 AM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Login_related_details
{
public partial class Login : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
SqlDataAdapter sqlda;
string str;
DataTable dt;
int RowCount;
protected void btn_login_Click(object sender, EventArgs e)
{
string UserName = TextBox_user_name.Text.Trim();
string Password = TextBox_password.Text.Trim();
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "Select * from Login";
com = new SqlCommand(str);
sqlda = new SqlDataAdapter(com.CommandText, con);
dt = new DataTable();
sqlda.Fill(dt);
RowCount = dt.Rows.Count;
for (int i = 0; i < RowCount; i++)
{
UserName = dt.Rows[i]["UserName"].ToString();
Password = dt.Rows[i]["Password"].ToString();
if (UserName == TextBox_user_name.Text && Password == TextBox_password.Text)
{
Session["UserName"] = UserName;
Response.Redirect("Details.aspx");
}
else
{
lb1.Text = "Invalid User Name or Password! Please try again!";
}
}
}
}
}
Sreejesh SPPosted Mar 13, 2013, 12:56 AM
I will explain a validation for using javascript
This script use to allow alphabets in textbox,not allow numeric charecter in text box,please
try this code and again implement another j script code by using this method
Thanks
sreejesh
Vishal GilbilePosted Mar 13, 2013, 12:51 AM
Kindly go through the following links.
http://www.c-sharpcorner.com/UploadFile/17e8f6/controlling-button-execution-through-javascript-function/
http://www.c-sharpcorner.com/UploadFile/17e8f6/repeater-control-in-Asp-Net/
http://www.c-sharpcorner.com/uploadfile/17e8f6/how-to-getset-values-of-controls-in-Asp-Net-using-javascript/
http://www.c-sharpcorner.com/uploadfile/17e8f6/populate-a-dropdownlist-control-using-javascript-in-Asp-Net/
http://www.c-sharpcorner.com/uploadfile/17e8f6/how-to-create-a-calendar-control-in-Asp-Net/
Hope that solves your problem. Kindly mark the answer as accepted if it helps you.
With Regards,
Vishal Gilbile.