public void BindState() { DDLState.DataSource = Destination.GetDestination("adminstate"); DDLState.DataBind(); DDLState.Items.Insert(0, new ListItem("-Select State-", "0")); DDLCity.Items.Insert(0, new ListItem("-Select City-", "0")); }
protected void DDLCountry_SelectedIndexChanged(object sender, EventArgs e) { List <string> ls = new List <string>(); ls.Clear(); ls.Add("Select State"); switch (DDLCountry.Text) { case "India": ls.Add("Karnataka"); ls.Add("Tamilnadu"); ls.Add("Kerala"); ls.Add("Andhra Pradesh"); break; case "US": ls.Add("Washington"); ls.Add("England"); break; case "Nigeria": ls.Add("Kaduna"); ls.Add("Nassarawa"); ls.Add("Abuja"); ls.Add("Lagos"); break; } DDLState.DataSource = ls; DDLState.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select * from State"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); DDLState.DataSource = dt; DDLState.DataTextField = "Name"; DDLState.DataValueField = "Id"; DDLState.DataBind(); DDLState.Items.Insert(0, new ListItem("Select", "0".ToString())); sql = "Select * from Degree"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda1 = new SqlDataAdapter(command); DataTable dt1 = new DataTable(); sda1.Fill(dt1); DDLDegree.DataSource = dt1; DDLDegree.DataTextField = "Value"; DDLDegree.DataValueField = "Id"; DDLDegree.DataBind(); DDLDegree.Items.Insert(0, new ListItem("Select", "0".ToString())); sql = "Select * from JobSeeker where username=@user"; command = new SqlCommand(sql, cnn); command.Parameters.AddWithValue("@user", Session["Username"]); SqlDataAdapter sda2 = new SqlDataAdapter(command); DataTable dt2 = new DataTable(); sda1.Fill(dt2); FNTB.Text = dt2.Rows[0]["First Name"].ToString(); LNTB.Text = dt2.Rows[0]["Last Name"].ToString(); AddrTB.Text = dt2.Rows[0]["Address"].ToString(); PinTB.Text = dt2.Rows[0]["Pincode"].ToString(); ResumeTB.Text = dt2.Rows[0]["Resume"].ToString(); CertificateTB.Text = dt2.Rows[0]["Certificate"].ToString(); cnn.Close(); } }
public void BindState() { string str = "Select [StateId],[StateName] FROM [Come2myCityDB].[come2mycity].[StateMaster]"; SqlCommand cmd = new SqlCommand(str, con); cmd.Connection = con; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); DDLState.DataSource = ds; if (ds.Tables[0].Rows.Count > 0) { DDLState.DataTextField = "StateName"; DDLState.DataValueField = "StateId"; } DDLState.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select * from State"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); DDLState.DataSource = dt; DDLState.DataTextField = "Name"; DDLState.DataValueField = "Id"; DDLState.DataBind(); DDLState.Items.Insert(0, new ListItem("Select", "0".ToString())); DDLState0.DataSource = dt; DDLState0.DataTextField = "Name"; DDLState0.DataValueField = "Id"; DDLState0.DataBind(); DDLState0.Items.Insert(0, new ListItem("Select", "0".ToString())); sql = "Select * from Degree"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda1 = new SqlDataAdapter(command); DataTable dt1 = new DataTable(); sda1.Fill(dt1); DDLDegree.DataSource = dt1; DDLDegree.DataTextField = "Value"; DDLDegree.DataValueField = "Id"; DDLDegree.DataBind(); DDLDegree.Items.Insert(0, new ListItem("Select", "0".ToString())); cnn.Close(); } }