I have a hidden input:
<input type="hidden" class="deleted" name="Deleted" data-id="@Model.Id" value="@Model.Deleted" />
I wanted to convert this to the MVC HiddenFor helper.
Got this:
@Html.HiddenFor(x => x.Deleted, new { @class="deleted" })
Thus, it covers the class. I also need the attribute and value of the data identifier.
Tried to add data id as:
@Html.HiddenFor(x => x.Deleted, new { @class="deleted", data-id="@Model.Id" })
Well, the helper doesn't seem to like the hyphen in the data id.
So how to get it?
Also how to get value="@Model.Deleted"there too?
source
share