We try to be type safe in our views and use the new ExpressionInputExtenssion HtmlHelpers, but we see some inconsistent results. We have a view that looks like this:
ViewData.Model.FooID = <%= ViewData.Model.FooID %><
Model.FooID = <%= Model.FooID %>
<%= Html.HiddenFor(x=>x.FooID) %>
But what we see in the visualized representation is this:
ViewData.Model.FooID = 515b0403-e75b-4bd7-9b60-ef432f39d338
Model.FooID = 515b0403-e75b-4bd7-9b60-ef432f39d338
<input id="FooID" name="FooID" type="hidden" value="" />
I can manually add this:
<input id="FooID" name="FooID" type="hidden" value="<%= Model.FooID %>" />
But now we are no longer there, but surprisingly when I do this, Html.HiddenFor always has the correct meaning.
source
share