protected void cityDropDownList_SelectedIndexChanged(object sender, EventArgs e) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { if (!string.IsNullOrEmpty(cityDropDownList.SelectedItem.Value)) { leagueDropDownList.Items.Clear(); List <SelectDivisionByLeagueIdResult> results = dataContext.SelectDivisionByLeagueId(Convert.ToInt32(cityDropDownList.SelectedItem.Value)).ToList(); foreach (SelectDivisionByLeagueIdResult result in results) { leagueDropDownList.Items.Add(new ListItem(result.Division, result.DivisionId.ToString())); } } } }