public List <SelectListItem> GetSelectListItemsForDropdown() { List <Student> students = studentGetway.AllStudent(); List <SelectListItem> selectListItems = new List <SelectListItem>(); selectListItems.Add(new SelectListItem() { Text = "--Select--", Value = "" }); foreach (Student student in students) { SelectListItem selectListItem = new SelectListItem(); selectListItem.Text = student.RegistrationNo; selectListItem.Value = student.Id.ToString(); selectListItems.Add(selectListItem); } return(selectListItems); }