2

At form submission, I am using @Html.HiddenFor(a => a.ModelParameter) to hold all of the values as it makes its way to the controller. My question is, for Models that have many parameters (25+) is there a better way to pass all of those parameters using @Html.HiddenFor?

For example,

foreach(var parameter in Model) { @Html.HiddenFor(modelItem => modelItem.parameter) }

Or something along these lines to avoid having to do an individual @Html.HiddenFor for every single parameter.

1 Answer 1

1

You could set an attribute on the properties that are supposed to be hidden.

Is there some way to use @Html.HiddenFor for complete model?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.