Mvc: Equivalent of @Html.Hidden or @Html.HiddenFor in MVC6 Tag Helper

Created on 25 Aug 2016  ·  3Comments  ·  Source: aspnet/Mvc

What is the equivalent of the above two HTML helpers in MVC6 Tag helper? I want to hide primary key of a model (table) in an MVC Core view using tag Helper.

Most helpful comment

For @Html.HidenFor(m => m.Property), use <input asp-for="Property" type="hidden"/>.

Tag helpers do not support the older expression name approach. So there's no direct equivalent for @Html.Hidden().

All 3 comments

For @Html.HidenFor(m => m.Property), use <input asp-for="Property" type="hidden"/>.

Tag helpers do not support the older expression name approach. So there's no direct equivalent for @Html.Hidden().

@dougbu It works - thank you. I'm closing the issue.

So a value attribute is not needed?
@dougbu

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KLuuKer picture KLuuKer  ·  3Comments

LiangZugeng picture LiangZugeng  ·  3Comments

workmonitored picture workmonitored  ·  3Comments

Mr-Smileys picture Mr-Smileys  ·  3Comments

hikalkan picture hikalkan  ·  4Comments