public ActionResult Enrollment() { if (Session["school"] == null) { return(RedirectToAction("Login", "Account", new { area = "" })); } //ViewBag.CourseId = new SelectList(db.Courses, "courseId", "Code"); //ViewBag.StudentList = db.Students.ToList(); int schoolid = Convert.ToInt32(Session["school"]); int RoleID = 2; StudentDBHandle gc = new StudentDBHandle(); List <tbl_StudentValidation> list = gc.GetSchoolStudent(schoolid); ViewData["student_name"] = new SelectList(list, "RegNo", "RegNo"); CourseDBHandle gc1 = new CourseDBHandle(); List <tbl_OnlineTestValidation> courselist = gc1.GetSchoolCourse(schoolid, RoleID); ViewData["course_name"] = new SelectList(courselist, "courseId", "courseName"); return(View()); }