I have this two lines in a Razor template:
@Html.Hidden("step", Model.Step)
<p>@Html.Label(Model.Step.ToString())</p>
And they produce two different values:
<input data-val="true"
data-val-number="The field Step must be a number."
data-val-required="The Step field is required."
id="step"
name="step"
type="hidden"
value="0">
<p>
<label for="">1
</label>
</p>
How is this possible?
Property Step
is of a type Int32
and is incremented every POST action.
EDIT:
@model ***.WebUI.Models.OrderViewModel
@{
ViewBag.Title = "New order";
}
<h2>
New order</h2>
@using (Html.BeginForm())
{
@Html.Hidden("step", Model.Step)
<p>@Html.Label(Model.Step.ToString())</p>
<div>
//other inputs
</div>
}