I am new to ASPNET MVC. I have searched many hours but couldn't find a way to solve my simple problem.
For a Model with properties like "property1" "property2" "property3", I want to simplify the code in a View to something like:
for (i = 1; i <=3; i++) {
@Html.EditorFor(model=>model.["property"+i];
}
How to replace the expression with custom names?
Thanks a lot
You can use the weakly typed version :
for (i = 1; i <=3; i++) {
@Html.Editor("property"+i);
}