ASP.NET MVC 2 HiddenField is empty?

2019-07-15 15:03发布

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 %>" />

0条回答
登录 后发表回答