Hi
I would like to add a prefix to controls in a partial view so that they bind correctly to the model on submitting a form however the way to do this by passing a viewdatadictionary with templateinfo as a parameter in the @html.partial method does not appear work with .net core.
@Html.Partial("_AddressView", Model.Donor.Address, new ViewDataDictionary { TemplateInfo = new TemplateInfo{ HtmlFieldPrefix = nameof(Model.Donor.Address) } })
update: I finally got a solution to work in the meantime though not sure it's the best or even recommended but thought I'd share. You have to remember to reset the prefix after this otherwise all controls after the partial view will also have this prefix.
@{ViewData.TemplateInfo.HtmlFieldPrefix = "Donor.Address"; } @Html.Partial("_AddressView", Model.Donor.Address)
Is this no longer available in .net core. Any help would be much appreciated.
Thanks