Chriztian Steinmeier
12/11/2023, 8:54 AM~/Views/Shared/EditorTemplates/
. I can sort of follow that - but I have no idea how they get from
@Html.EditorFor(m => registerModel.MemberProperties[i].Value)
to this output:
<input class="text-box single-line" id="registerModel_MemberProperties_3__Value" name="registerModel.MemberProperties[3].Value" type="text" value="">
(e.g. the '3' here is not sent in, so how does the view get this information?) - how am I supposed to "easily" do this? Thanks!Rachel D
12/11/2023, 10:32 AM@Html.IdFor(m => m.Property)
and @Html.NameFor(m => m.Property)
. The 3
comes from the value of i
when you pass it into the EditorFor
method, and these two methods pick that up and give you the appropriate value.Chriztian Steinmeier
12/11/2023, 11:54 AMstring
into the method (AFAIK). How does it get all that info from that?Rachel D
12/11/2023, 11:58 AMm => registerModel.MemberProperties[i].Value
), it can use reflection to get the metadata rather than the value of that expression (if I'm remembering right)Rachel D
12/11/2023, 11:59 AMrasmusjp
12/11/2023, 12:09 PMasp-for
it should accept the expression as a string, not sure if it works with EditorFor
though as it's meant to be an alternative https://learn.microsoft.com/en-us/aspnet/core/mvc/views/working-with-forms?view=aspnetcore-8.0#expression-namesChriztian Steinmeier
12/11/2023, 12:55 PM