You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Hello,
When trying to use tag helpers in display or editor templates, example:
Views/Shared/EditorTemplates/DateTime.cshtml:
@modelDateTime?<input asp-for="" type="text"/>
I get an error stating that asp-for is a tag helper bound value to a type of ModelExpression and it cannot be null or whitespace. But there is a valid use case for passing an empty asp-for attribute which is the functional analogue of:
@modelDateTime?
@Html.Textbox(string.Empty)
Which simply uses the model prefix in the name and id attributes.
The alternative would be a new asp-for-model valueless attribute on the existing tag helpers to allow this functionality. Allowing this will allow the best of both the tag helpers and templated helpers to be used at once.
Until then, I am forced to use the ancient helpers in my complex editor templates.
Thanks for considering this and let me know if you need any further info.
The text was updated successfully, but these errors were encountered:
You should be able to do asp-for="@Model", but there is another issue blocking that usage: #3978. Closing this issue since we don't plan to support asp-for="".
So we can, or we cannot, use asp-for tag helpers in Display/Edit templates?
Because it's now almost 2018 and these asp-for's are not working in my template.
Seems lame to come up with this whole idea that supplants the old HTML helpers and then to just definitively say: "nah, but we aren't going to support it here".
@seraphx2 you're correct, they currently aren't supported for display/editor templates. However, @DamianEdwards has done work to provide TagHelper editor template implementations that do work. Take a look at his repo.
Hello,
When trying to use tag helpers in display or editor templates, example:
Views/Shared/EditorTemplates/DateTime.cshtml:
I get an error stating that asp-for is a tag helper bound value to a type of ModelExpression and it cannot be null or whitespace. But there is a valid use case for passing an empty asp-for attribute which is the functional analogue of:
Which simply uses the model prefix in the name and id attributes.
The alternative would be a new asp-for-model valueless attribute on the existing tag helpers to allow this functionality. Allowing this will allow the best of both the tag helpers and templated helpers to be used at once.
Until then, I am forced to use the ancient helpers in my complex editor templates.
Thanks for considering this and let me know if you need any further info.
The text was updated successfully, but these errors were encountered: