void BuildRegion() { string str = "select RegionID, RegionDescription from Region"; RegionDropDownList.DataSource = mydb.BuildDataTable(str); RegionDropDownList.DataBind(); }
protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e) { var countryId = Convert.ToInt32(CountryDropDownList.SelectedValue); var countryService = new CountryService(); RegionDropDownList.DataSource = countryService.GetSelectRegion(countryId).DataSet; RegionDropDownList.DataTextField = "RegionName"; RegionDropDownList.DataValueField = "Id"; RegionDropDownList.DataBind(); this.PasswordTextRegister.Attributes["value"] = PasswordTextRegister.Text.Trim(); this.PasswordRepeatText.Attributes["value"] = PasswordRepeatText.Text.Trim(); }
public void BindCountryAndRegion() { var countryService = new CountryService(); DataTable resultCountry = countryService.GetCountries(); CountryDropDownList.DataSource = resultCountry; CountryDropDownList.DataTextField = "CountryName"; CountryDropDownList.DataValueField = "Id"; CountryDropDownList.DataBind(); var countryId = Convert.ToInt32(CountryDropDownList.SelectedValue); RegionDropDownList.DataSource = countryService.GetSelectRegion(countryId).DataSet; RegionDropDownList.DataTextField = "RegionName"; RegionDropDownList.DataValueField = "Id"; RegionDropDownList.DataBind(); }