In DinnerController I got a data.
public ActionResult Details(int id)
{
Dinner dinner = dinnerRepository.GetDinner(id);
if (dinner == null)
return View("NotFound");
else
return View("Details", dinner);
}
and in details.aspx I bound it like this.
<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>
but I got a error.
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?).
I just start to learn mvc and unable to understand the problem.May I missing something.Plz help?
I forget to check the check box
Create a strongly-typed viewwhen create a view show i got this error.i solve this through adding<HelloMvc.Models.Dinner>indetails.aspxpage. Means when I got error code like this.After solve the problem code becames:
Thanks for reply.I post this ans for future ref.