public static AjaxControlToolkit.CascadingDropDownNameValue[] GetDropDownContents2(string knownCategoryValues, string category) { aulacepEntities contexto = new aulacepEntities(); StringDictionary kv = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); int id_ciclo = int.Parse(kv["ciclos"]); List <cursos> l_cursos = (from c in contexto.cursos where c.id_cicle == id_ciclo select c).ToList(); AjaxControlToolkit.CascadingDropDownNameValue[] resultados = new AjaxControlToolkit.CascadingDropDownNameValue[l_cursos.Count]; int i = 0; foreach (cursos item in l_cursos) { AjaxControlToolkit.CascadingDropDownNameValue res = new AjaxControlToolkit.CascadingDropDownNameValue(); res.name = item.codi; res.value = item.id.ToString(); resultados[i] = res; i++; } return(resultados); }
public static AjaxControlToolkit.CascadingDropDownNameValue[] GetDropDownContents(string knownCategoryValues, string category) { aulacepEntities contexto = new aulacepEntities(); List <cicles> ciclos = (from c in contexto.cicles select c).ToList(); AjaxControlToolkit.CascadingDropDownNameValue[] resultados = new AjaxControlToolkit.CascadingDropDownNameValue[ciclos.Count]; int i = 0; foreach (cicles item in ciclos) { AjaxControlToolkit.CascadingDropDownNameValue res = new AjaxControlToolkit.CascadingDropDownNameValue(); res.name = item.codi; res.value = item.id.ToString(); resultados[i] = res; i++; } return(resultados); }