public void GetParticipantTypeList_Bind() { CRUDModels cm = new Models.CRUDModels(); DataSet ds = cm.GetParticipantTypeList(); List <SelectListItem> participantTypeList = new List <SelectListItem>(); foreach (DataRow dr in ds.Tables[0].Rows) { participantTypeList.Add(new SelectListItem { Text = dr["ParticipantType"].ToString(), Value = dr["ParticipantType"].ToString() }); } ViewBag.ParticipantType = participantTypeList; }
/*** --- CASCADED DROP DOWN LIST FOR LAB FORMS --- ***/ public ActionResult GetFormList(string studyId) { CRUDModels cm = new Models.CRUDModels(); DataSet ds = cm.GetFormList(studyId); List <SelectListItem> formNames = new List <SelectListItem>(); foreach (DataRow dr in ds.Tables[0].Rows) { //formNames.Add(new SelectListItem { Text = dr["FormName"].ToString(), Value = dr["FormID"].ToString() }); formNames.Add(new SelectListItem { Text = dr["FormName"].ToString(), Value = dr["ViewName"].ToString() }); } return(Json(formNames, JsonRequestBehavior.AllowGet)); }
public void StudyListToStudyID_Bind() { CRUDModels cm = new Models.CRUDModels(); DataSet ds = cm.GetStudyList(); List <SelectListItem> studyList = new List <SelectListItem>(); foreach (DataRow dr in ds.Tables[0].Rows) { studyList.Add(new SelectListItem { Text = dr["StudyName"].ToString(), Value = dr["StudyID"].ToString() }); } ViewBag.StudyIdentifier = studyList; }