Skip to content

Instantly share code, notes, and snippets.

<div class="editor-label">
<%= Html.LabelFor(model => model.Authors) %>
</div>
<span id="authorChackboxes">
<% List<Author> authors = ViewData["authors"] as List<Author>;
foreach (Author author in authors)
{
string checkboxId = string.Format("author{0}", author.Id); %>
<input type="checkbox"
id="<%= Html.Encode(checkboxId) %>"
//
// GET: /Book/Create
public ActionResult Create()
{
ViewData["authors"] = _entities.Authors.ToList<Author>();
return View();
}