protected void BindSchoolStandard() { try { string schooltype = null; //if (ddlSchoolType.SelectedItem.Text == "Select Type") //{ // schooltype = null; //} //else //{ // schooltype = ddlSchoolType.SelectedItem.Text; //} DataTable dtStandard = TMSSchoolCategory.GetSearch(null, null, null, null, 1).Tables[0]; if (dtStandard.Rows.Count > 0) { ddlStandard.DataSource = dtStandard; ddlStandard.DataValueField = "SC_CategoryId"; ddlStandard.DataTextField = "SC_CategoryName"; ddlStandard.DataBind(); ddlStandard.Items.Insert(0, new ListItem("Select Standard", "-1")); ddlDivision.Items.Insert(0, new ListItem("Select Division", "-1")); } } catch (Exception ex) { } }
public CascadingDropDownNameValue[] BindStandard(string knownCategoryValues, string category) { string[] str = knownCategoryValues.Split(':'); string SchoolType = str[1].Substring(0, str[1].IndexOf(';')).ToString(); DataTable dtClass = new DataTable(); dtClass = TMSSchoolCategory.GetSearch(null, null, SchoolType.ToString(), null, 1).Tables[0]; List <CascadingDropDownNameValue> cascadingValues = new List <CascadingDropDownNameValue>(); for (int i = 0; i < dtClass.Rows.Count; i++) { string ClassId = dtClass.Rows[i]["SC_CategoryId"].ToString(); string ClassName = dtClass.Rows[i]["SC_CategoryName"].ToString(); cascadingValues.Add(new CascadingDropDownNameValue(ClassName, ClassId)); } return(cascadingValues.ToArray()); }