Html.EditorFor() — editor template in portable area

*爱你&永不变心* 提交于 2019-12-24 09:55:07

问题


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?


回答1:


You could specify the location of the template:

<%= Html.EditorFor(x => x.Foo, "~/somepath/to/template.ascx") %>


来源:https://stackoverflow.com/questions/4055805/html-editorfor-editor-template-in-portable-area

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!