Am using MVC 4 and want to maintain some values on postback, so they're going into hidden fields. In essence:
@using (Html.BeginForm())
{
Html.HiddenFor(model => model.EventId);
Html.HiddenFor(model => model.paymentMethodId);
}
But the hidden fields are not appearing in the rendered markup and are therefore - obviously - missing on postback.
You need to add a @, @Html.HiddenFor(). Otherwise you're just executing the helper method, but not actually doing anything with the output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With