private void GetProgramLists() { DataTable dtProgramList = CRCDataAccess.ProgramCalendarSearch("*", "StartsWith"); ProgramList = (new SelectListItem[] { new SelectListItem() { Text = "Select a Program Name", Value = "" } }).Union((from DataRow row in dtProgramList.Rows select new SelectListItem() { Text = row["ProgramName"].ToString(), Value = row["ProgramId"].ToString() })); }
public ActionResult ProgramCalendarSearch(string term, string searchType) { using (var dt = CRCDataAccess.ProgramCalendarSearch(term, searchType)) { var searchResults = from DataRow dr in dt.Rows select new { value = dr["ProgramId"], label = dr["ProgramName"] }; return(Json(searchResults, JsonRequestBehavior.AllowGet)); } }