public CascadingDropDownNameValue[] BindCountry(string knownCategoryValues, string category) { DataTable dtCountry = new DataTable(); dtCountry = TMSCountry.GetSearch(null, null, 1).Tables[0]; List <CascadingDropDownNameValue> cascadingValues = new List <CascadingDropDownNameValue>(); for (int i = 0; i < dtCountry.Rows.Count; i++) { string CountryId = dtCountry.Rows[i]["CNTR_Id"].ToString(); string CountryName = dtCountry.Rows[i]["CNTR_Country"].ToString(); cascadingValues.Add(new CascadingDropDownNameValue(CountryName, CountryId)); } return(cascadingValues.ToArray()); }
protected void fillCountry() { try { DataTable Dtaable = TMSCountry.GetSearch(null, null, null).Tables[0]; DataView Dv = new DataView(Dtaable); Dv.Sort = ("CNTR_Country ASC"); ddlCountry.DataSource = Dtaable; ddlCountry.DataTextField = "CNTR_Country"; ddlCountry.DataValueField = "CNTR_Id"; ddlCountry.DataBind(); ddlCountry.Items.Insert(0, new ListItem("Select", "-1")); DataTable dtSubject = TMSSpeciallizationSubject.GetSearch(null, null, null, 1).Tables[0]; DataView Dv1 = new DataView(dtSubject); Dv1.Sort = ("SB_SubjectName ASC"); ddlSpeciallization.DataSource = dtSubject; ddlSpeciallization.DataTextField = "SB_SubjectName"; ddlSpeciallization.DataValueField = "SB_SubjectId"; ddlSpeciallization.DataBind(); ddlSpeciallization.Items.Insert(0, new ListItem("Select", "Select")); //ddlSpeciallization.Items.Add(new ListItem("Select", "-1")); } catch (Exception ex) { } }