Closed Eilon closed 5 years ago
Thanks for contacting us, @ciacco85. @dougbu, can you please look into this? Thanks!
Thank you for filing this issue. In order for us to investigate this issue, please provide a minimalistic repro project that illustrates the problem.
@ciacco85 thank-you for your feedback. We're closing this issue as no updates have been provided in a timely manner and we have been unable to reproduce the issue. If you have more details and are encountering this issue, please add a new reply and re-open the issue.
In particular,
to the viewcomponent
Please provide the view component source, both C# and the .cshtml
file (if any)
the model property testString is alwayse null.
Where?
Should I use the editor template o change the approch??
That's a good approach if I'm understanding the issue (guessing at the moment). View component invocations pass values but do not change the TemplateInfo.HtmlFieldPrefix
. That's by design.
From @ciacco85 on Friday, 19 October 2018 07:32:34
Using a Model like
and passing the b property to the viewcomponent
when posting the form, the model property testString is alwayse null. I've found a workaround, after a long experience with MVC, inside the viewcomponent, adding the "b" inside name
<input asp-for="testString" name="b.testString" class="form-control" />
but in this situation, a ViewComponent should know something about the class in wich the model is placed...two object coupled with no relationship is not that good Should I use the editor template o change the approch?? ViewComponent are so powerful. Thanks for your great work!!!
Copied from original issue: aspnet/AspNetCore#3673