我使用 mvc3 和代码优先脚手架,第一个片段来自 /post/index.cshtml
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id }) |
@Html.ActionLink("Comment", "Comment", new { id=item.Id })
</td>
我应该在动作中添加什么以使 /Commment/Create.cshtml 打开并使用帖子填充客栈的 ID 打开帖子字段?
public ActionResult Comment(int id)
{
throw new NotImplementedException();
}
这是帖子字段
<div class="editor-label">
@Html.LabelFor(model => model.PostID, "Post")
</div>
<div class="editor-field">
@Html.DropDownList("PostID", String.Empty)
@Html.ValidationMessageFor(model => model.PostID)
</div>