IEnumarable SelectList’s 4th parameter is just for that:
@Html.DropDownList("AuthorID", new SelectList(Model.Authors, "Id", "AuthorFullName", Model.Books.AuthorId), "---Select an Author---", new { @class = "form-control" })
Daily micro-tips for C#, SQL, performance, and scalable backend engineering.
IEnumarable SelectList’s 4th parameter is just for that:
@Html.DropDownList("AuthorID", new SelectList(Model.Authors, "Id", "AuthorFullName", Model.Books.AuthorId), "---Select an Author---", new { @class = "form-control" })