How can I tell the viewengine to look for editortemplates in another area that is in another web project?
A:
Have you tried putting full path to the template (~/Areas/YourArea/Views/...) in UIHintAttribute?
Update:
I assume the code (link in the comments below) comes from one application, while the actual template resides in a different application. IMHO this just won't work. You might want to google for sharing templates between applications but I think the only valid solution is not to share a template but add extension methods to HtmlHelper and share those.
Jakub Konecki
2010-10-16 15:37:53
This approach did not work for me
Marcus
2010-10-17 10:36:45
@Marcus - Are you keeping your templates in the Shared folder?
Jakub Konecki
2010-10-17 14:50:34
I Have two different web projects so the template folders is not shared between the projects. The goal is to have a kinda dashboard project/area and I would like to use editortemplates from my main projects/area
Marcus
2010-10-18 05:38:10
@Marcus - so you should change your question - it's not about reusing templates from another area, but from another project!
Jakub Konecki
2010-10-18 12:53:16
Well I thought it did not matter because I register the area the way you should, but maybe asp.net works differently if the area is in the same project?
Marcus
2010-10-18 13:04:53
@Marcus - Could you post your RegisterRoute code - how do you register a route from another application?
Jakub Konecki
2010-10-18 15:57:42
This is from my global.asax http://codepaste.net/1f4r4o and this is my area registration http://codepaste.net/uca4ig
Marcus
2010-10-18 16:43:04
@Marcus - I assume the code comes from one application, while the actual template resides in a different application. IMHO this just won't work. You might want to google for sharing templates between applications but I think the only valid solution is not to share a template but add extension methods to HtmlHelper and share those.
Jakub Konecki
2010-10-18 17:34:23
A:
You could specify the path when including the editor template:
<%: Html.EditorFor(x => x.SomeProp, "~/areas/somearea/views/editortemplates/test.ascx") %>
Or use the UIHint attribute on the model property.
Darin Dimitrov
2010-10-16 16:57:10
I use the UIHint attribute on my model but it seems like I must have my templates in main project?
Marcus
2010-10-17 10:36:19