Html.Hidden in MVC

The Html.Hidden helper renders a hidden input. For example, the following code:

@Html.Hidden("wizardStep", "1")

results in:

<input id="wizardStep" name="wizardStep" type="hidden" value="1" />

The strongly typed version of this helper is Html.HiddenFor. Assuming your model had a WizardStep property, you would use it as follows:

@Html.HiddenFor(m => m.WizardStep)
Tagged . Bookmark the permalink.

Leave a Reply