ID Being Rendered As Null In A Typed Razor View
问题 This is really weird, for some reason the Id of the ViewModel is being rendered as null inside the view. I debugged the application and checked that the view model is actually being mapped correctly (using AutoMapper) and everything is fine. But when I do @Model.Id, it is rendering as zero, and when I alert the value using jQuery I get "null". So what's going on? <div id="commentBox"> @using (Html.BeginForm("Comment", "Item", new { itemId = Model.Id } )) { <span class="greenText">answer</span