.net mvc
how to get records from database in dropdownlist using asp.net mvc
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jithil JohnPosted Feb 12, 2016, 12:41 AM
{
[Key]
public int EmployeeID { get; set; }
public int DepartmentID { get; set; }
public virtual Department Department { get; set; }
}
@Html.DropDownList("DepartmentID", null, htmlAttributes: new { @class = "form-control" })
ViewBag.DepartmentID = new SelectList(db.Department, "DepartmentID", "DepartmentName");
return View();
}
Ankur MistryPosted Jan 1, 2016, 10:50 AM
Ranjit PowarPosted Jan 1, 2016, 5:03 AM