Beispiel #1
0
 protected void ddlCountries_SelectedIndexChanged(object sender, DropDownListEventArgs e)
 {
     try {
         countryID            = int.Parse(e.Value);
         Session["CountryID"] = countryID;
         RadDropDownList  ddlCountries = (RadDropDownList)sender;
         GridEditableItem item         = (GridEditableItem)ddlCountries.NamingContainer;
         RadDropDownList  ddlPlaces    = (RadDropDownList)item.FindControl("ddlPlaces");
         ddlPlaces.ClearSelection();
         PlacesController cont = new PlacesController();
         ddlPlaces.DataSource     = cont.GetPlaces().Where(k => k.CountryID == countryID);
         ddlPlaces.DataTextField  = "NameGR";
         ddlPlaces.DataValueField = "ID";
         ddlPlaces.DataBind();
         ddlPlaces.SelectedIndex = 0;
         if (ddlPlaces.Items.Count > 0)
         {
             Session["PlaceID"] = ddlPlaces.SelectedItem.Value;
         }
         else
         {
             Session.Remove("PlaceID");
         }
     }
     catch (Exception) { }
 }