Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DropDownListCountries.DataSource = products;
         DropDownListCountries.DataBind();
         RebindTowns();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CountriesDataContext context = new CountriesDataContext();
         DropDownListCountries.DataSource = context.Countries;
         DropDownListCountries.DataBind();
         RebindTowns();
     }
 }
Пример #3
0
 private void RebindTowns()
 {
     DropDownListCountries.DataSource = products;
     DropDownListCountries.DataBind();
     //int countryId = int.Parse(DropDownListCountries.SelectedValue);
     //CountriesDataContext context = new CountriesDataContext();
     //var towns =
     //    from town in context.Towns
     //    where town.CountryID == countryId
     //    select town;
     //DropDownListTowns.DataSource = towns;
     //DropDownListTowns.DataBind();
 }