public ActionResult Appointment() { if (Session["user"] != null) { var data1 = clinic.DocAppointment(2); List <SelectListItem> objitem1 = new List <SelectListItem>(); foreach (spDocDetails_Result item in data1) { objitem1.Add(new SelectListItem { Text = item.UserID + "," + item.FirstName + " " + item.LastName, Value = item.UserID.ToString() }); } TempData["DocDetails"] = objitem1; var data2 = clinic.PatAppointment(3); List <SelectListItem> objitem2 = new List <SelectListItem>(); foreach (spPatientDetails_Result item in data2) { objitem2.Add(new SelectListItem { Text = item.UserID + "," + item.FirstName + " " + item.LastName, Value = item.UserID.ToString() }); } TempData["PatDetails"] = objitem2; return(View()); } return(View()); }