Reputation: 457
I have this code line in my MVC 4 application which was converted from MVC 3:
@Html.HiddenFor(model => model.IsInhouse) // IsInhoue is bool
This worked fine when application is MVC 3 but now it's malfunctioning.
I tried displaying the value using @Html.LabelFor(model => model.IsInhouse) and it displays as 'IsInhouse', not saying the content value.
Any clue on this issue is appriciated. I'm new to MVC.
EDIT: Replacing @Html.HiddenFor with <input type="hidden" name="IsInhouse" value="@Html.AttributeEncode(Model.IsInhouse)" id="IsInhouse" />
solved the issue.
Upvotes: 0
Views: 761
Reputation: 1898
LabelFor
would display its Property Name, that's its purpose. To get its value, use EditorFor
Upvotes: 2