This is the class:
public class Book
{
public int id { get; set; }
public string BookName { get; set; }
public int AuthorId { get; set; }
public string AuthorFirstName { get; set; }
public string AuthorLastName { get; set; }
public List<Author> Authors_List { get; set; }
}
CSHTML:
<div class="form-group">
@Html.LabelFor(model => model.AuthorId, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.AuthorId, new { htmlAttributes = new { @class = "form-control" } })
@*@Html.DropDownList("AuthorId", null, htmlAttributes: new { @class = "form-contol"})*@
@Html.ValidationMessageFor(model => model.AuthorId, "", new { @class = "text-danger" })
</div>
</div>
I just don't understand how to return the authorList as a dropdown
authorobject list items to properly build your drop down list