protected void ddlState_SelectedIndexChanged(object sender, EventArgs e) { objService = new ServeAtDoorstepService(); DataTable dtCy = objService.SelectCityByStateId(Convert.ToInt32(ddlState.SelectedIndex.ToString())); ddlCity.Items.Clear(); ListItem listItem = new ListItem(); listItem.Text = "<Select City>"; listItem.Value = "0"; ddlCity.Items.Add(listItem); for (int i = 0; i < dtCy.Rows.Count; i++) { listItem = new ListItem(); listItem.Text = dtCy.Rows[i]["CityName"].ToString(); listItem.Value = dtCy.Rows[i]["CityId"].ToString(); ddlCity.Items.Add(listItem); } }
void LoadProfile() { objService = new ServeAtDoorstepService(); DataTable dtCus = objService.GetCustomerById(Convert.ToInt32(sLoginId)); if (dtCus.Rows.Count > 0) { spnCusImage.InnerHtml = "<a class='example-image-link' href='" + dtCus.Rows[0]["ImagePath"].ToString() + "' data-lightbox='example-1'" + "title='Or press the right arrow on your keyboard.'>" + "<img class='example-image' src='" + dtCus.Rows[0]["ImagePath"].ToString() + "' alt='Plants: image 2 0f 4 thumb' width='150' height='150' /></a>"; txtFirstName.Value = dtCus.Rows[0]["FirstName"].ToString();// +" " + dtCus.Rows[0]["LastName"].ToString(); txtLastName.Value = dtCus.Rows[0]["LastName"].ToString(); lblLoginName.Text = dtCus.Rows[0]["LoginName"].ToString(); sLoginname = dtCus.Rows[0]["LoginName"].ToString(); sPassword = dtCus.Rows[0]["LoginPassword"].ToString(); sImagePath = dtCus.Rows[0]["ImagePath"].ToString(); lblEmail.Text = dtCus.Rows[0]["Email"].ToString(); txtEmail.Value = dtCus.Rows[0]["Email"].ToString(); txtMobile.Value = dtCus.Rows[0]["Mobile"].ToString(); rdoGender.SelectedValue = dtCus.Rows[0]["Gender"].ToString(); for (int i = 0; i < ddlCountry.Items.Count; i++) { if (ddlCountry.Items[i].Text == dtCus.Rows[0]["CountryName"].ToString()) ddlCountry.SelectedIndex = i; } for (int i = 0; i < ddlState.Items.Count; i++) { if (ddlState.Items[i].Text == dtCus.Rows[0]["StateName"].ToString()) ddlState.SelectedIndex = i; } string sState = dtCus.Rows[0]["StateName"].ToString(); string sStateId = dtCus.Rows[0]["StateId"].ToString(); DataTable dtCy = objService.SelectCityByStateId(Convert.ToInt32(sStateId)); ddlCity.Items.Clear(); ListItem listItem = new ListItem(); listItem.Text = "<Select City>"; listItem.Value = "0"; ddlCity.Items.Add(listItem); for (int i = 0; i < dtCy.Rows.Count; i++) { listItem = new ListItem(); listItem.Text = dtCy.Rows[i]["CityName"].ToString(); listItem.Value = dtCy.Rows[i]["CityId"].ToString(); ddlCity.Items.Add(listItem); } for (int i = 0; i < ddlCity.Items.Count; i++) { if (ddlCity.Items[i].Text == dtCus.Rows[0]["CityName"].ToString()) ddlCity.SelectedIndex = i; } txtAddress.Value = dtCus.Rows[0]["Address"].ToString(); txtStreetname.Value = dtCus.Rows[0]["StreetName"].ToString(); txtZipcode.Value = dtCus.Rows[0]["ZipCode"].ToString(); sBankId = dtCus.Rows[0]["BankId"].ToString(); hdnAddress.Value = dtCus.Rows[0]["CityName"].ToString().Trim() + ", " + dtCus.Rows[0]["StateName"].ToString() + ", US"; } }