I am trying to use a partial view editor template in my application using the Html.EditorFor method in my view. If the editor template is directly in the Views/Shared/EditorTemplates directory of my application, it works great. If the editor template in the Views/Shared/EditorTemplates directory of the portable area I am using in my application (which is my intent in using this so I can use the same template in more than just this application), it is not being found. Is there a way I can make it locate the view in the portable area?
Html.EditorFor() -- editor template in portable area
Asked Answered
You could specify the location of the template:
<%= Html.EditorFor(x => x.Foo, "~/somepath/to/template.ascx") %>
thanks very much for the answer. i've been banging my head against this trying to get it to work, and i just can't seem to make it happen. my template ascx file is set as embedded resource and i'm using this: <%= Html.EditorFor(x => x.Foo, "~/PortableAreaName/Views/Shared/EditorTemplates/template.ascx") %>. that's the right path, right? this is supposed to work, right? has anyone ever actually done this and seen it work? –
Romanesque
what i was trying to do before that wasn't working just now seems to magically work. not sure i understand it, but will just accept this answer. –
Romanesque
© 2022 - 2024 — McMap. All rights reserved.