Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     textLabel.Text = WebConfigurationManager.AppSettings["TennisCourtGridLabelText"].ToString();
     if (!Page.IsPostBack)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             List <SelectUniqueTennisCourtCitiesResult> selectUniqueTennisCourtCitiesResults = dataContext.SelectUniqueTennisCourtCities(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
             citiesDropDownList.Items.Add(new ListItem("All Cities", "All Cities"));
             foreach (SelectUniqueTennisCourtCitiesResult result in selectUniqueTennisCourtCitiesResults)
             {
                 citiesDropDownList.Items.Add(new ListItem(result.City, result.City));
             }
             citiesDropDownList.Items[1].Selected = true;
         }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList   homeCourtDropDownList  = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("homeCourtDropDownList");
            DropDownList   leagueCityDropDownList = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("leagueCityDropDownList");
            RadCaptcha     radCaptcha             = (RadCaptcha)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("radCaptcha");
            RadAjaxManager radAjaxManage          = RadAjaxManager.GetCurrent(Page);

            radAjaxManage.AjaxSettings.AddAjaxSetting(leagueCityDropDownList, homeCourtDropDownList);
            radAjaxManage.AjaxSettings.AddAjaxSetting(leagueCityDropDownList, radCaptcha);
            if (!Page.IsPostBack)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    List <SelectUniqueTennisCourtCitiesResult> selectUniqueTennisCourtCitiesResults = dataContext.SelectUniqueTennisCourtCities(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
                    foreach (SelectUniqueTennisCourtCitiesResult result in selectUniqueTennisCourtCitiesResults)
                    {
                        leagueCityDropDownList.Items.Add(new ListItem(result.City, result.City));
                    }
                    leagueCityDropDownList.Items[0].Selected = true;
                    homeCourtDropDownList.Items.Add(string.Empty);
                    List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtByCity(selectUniqueTennisCourtCitiesResults[0].City, Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
                    foreach (TennisCourt tennisCourt in tennisCourts)
                    {
                        homeCourtDropDownList.Items.Add(new ListItem(tennisCourt.CourtName, tennisCourt.CourtId.ToString()));
                    }
                }
            }
        }