public ActionResult OPDPatient() { List <OPDPatient> PatientList = new List <OPDPatient>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchOtpPatient"; ds = dl.FetchOtpPatient_sp(p); List <SelectListItem> DoctorList = new List <SelectListItem>(); DoctorList.Add(new SelectListItem { Text = "Select", Value = "" }); foreach (DataRow dr in ds.Tables[1].Rows) { DoctorList.Add(new SelectListItem { Text = dr["FullName"].ToString(), Value = dr["FullName"].ToString() }); } ViewBag.DoctorList = new SelectList(DoctorList, "Value", "Text"); foreach (DataRow item in ds.Tables[0].Rows) { OPDPatient m = new OPDPatient(); m.PatientId = item["PatientId"].ToString(); m.Name = item["Name"].ToString(); m.GuardianName = item["GuardianName"].ToString(); m.Phone = item["Phone"].ToString(); m.Gender = item["Gender"].ToString(); m.ConsultantDoctor = item["ConsultantDoctor"].ToString(); PatientList.Add(m); } ViewBag.PatientList = PatientList; return(View()); }