public class MyModelClass { public string propertyA { set; get; } public int propertyB { set; get; } }
My View uses a List<MyModelClass> model to load a list of items for editing.
I am able to access the list of edited items through @Model[i].propertyA while iterating with i as the for loop indexer.
However I need to access the originally loaded items through the asp-for tag helper as follows:
<input type = "input" asp-for = "[@i].propertyA" />
This last line doesn't work.
NOTE: when the model is not a List<MyModelClass> but just an instance of the MyModelClass,
I simply use the following <input type = "input" asp-for = "propertyA" />
and it works without an issue.
so, how does one use asp-for to target a property of a class T when the Model is List<T>