ASP.NET MVC 2 HiddenField is empty?

天大地大妈咪最大 提交于 2019-12-11 03:32:52

问题


Hi,

I have a ViewClass that contains a CI property (Guid), to keep track of this CI property I have added a hidden value for it like this :

<%: Html.HiddenFor(model => model.CI)%>

This does however render an empty hidden field, i have also tried :

<%: Html.Hidden("CI", Model.CI)%>

But with the same result.

When just typing :

<%: Model.CI %>

The Guid is printed for example like this : 5f7a1f53-9f90-4b77-aad4-64e835662efc

So why is this not working?

Edit1 :

This workes fine, but I do not see why HiddenFor is not working?

<input type="hidden" name="CI" value="<%: Model.CI %>" />

来源:https://stackoverflow.com/questions/4867717/asp-net-mvc-2-hiddenfield-is-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!