Difference between Html.HiddenFor & HiddenInput attribute

Description HiddenFor : Returns a hidden HTML input element for each property of the object that is represented by the specified expression.

I read that for fields in Model / ViewModel it’s useful that you save on the page and come back when another call was made, but should not be visible to the user.

Description HiddenInput : Represents an attribute that is used to indicate whether a property or field value should be displayed as a hidden input element.

Could you tell me when HiddenInput is useful? and when to use it instead of Html.HiddenFor?

Thank!

+5
source share
1 answer

HiddenFor - viewmodel .

HiddenInput (view), , , , EditorFor

+10

All Articles