我試圖在單個cshtml文件中使用多個模型。我的代碼是:html中的多個模型
@model CostumeContest.Models.VoteModel
@{
ViewBag.Title = "Vote";
}
<h2 style="color: #B45F04">Vote Receipt</h2>
<b>Your Name:</b> @Model.VoterName
<br />
<b>Your Vote for Best Costume: </b>@Model.BestName
<br />
<b>Your Vote for Most Creative Costume:</b> @Model.CreativeName
<br />
<h2 style="color: #B45F04">Vote Summary</h2>
//@model CostumeContest.Models.VoteResult this is giving me problems when not commented out
<h3 style="color: #B45F04">Best Costume</h3>
<h3 style="color: #B45F04">Most Creative Costume</h3>
我在上面做什麼錯,更重要的是,我該如何解決我的問題?謝謝。
這沒有任何意義。你的行爲會是什麼樣子? – SLaks
[ASP MVC 3中的一個視圖中的兩個模型]的副本(http://stackoverflow.com/questions/5550627/two-models-in-one-view-in-asp-mvc-3/7558510) – Bobson