在DinnerController
我得到了一个数据。
public ActionResult Details(int id)
{
Dinner dinner = dinnerRepository.GetDinner(id);
if (dinner == null)
return View("NotFound");
else
return View("Details", dinner);
}
我像这样details.aspx
绑定它。
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>
Details</h2>
<fieldset>
<legend>Fields</legend>
<p>
DinnerID:
<%= Html.Encode(Model.DinnerID) %>
</p>
</fieldset>
</asp:Content>
但我有一个错误。
Compiler Error Message: CS1061: 'object' does not contain a definition for 'DinnerID' and no extension method 'DinnerID' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
.
我刚开始学习mvc
并且无法理解问题。我可能遗漏了什么。请帮忙?