MVC 3 DisplayTemplates

Topics: Writing modules
Feb 9, 2012 at 3:52 PM


I know I sould be using Shapes when dealing with templates in Orchard but regardless of that I want to do it using MVC 3 display templates.

I can get templates to render for specific properties with @Html.DisplayFor when put in specific controller view folder like Views/Home/DisplayTemplates/Model.cshtml...but when I try to render a template from the shared folder that I wan't all of my controllers to pick up it just doesn't work (e.g. Views/Shared/DisplayTemplates/Model.cshtml)

Are there any workarounds?


Feb 9, 2012 at 5:03 PM

Actualy Shapes are not used when building backend (dashboard functionality) ... what I'm trying to achieve is create some templates for manipulating my own custom types. In those templates I wan't to have a table with the Action/Filter/Sort functionality  in the in DashBoard/Users

Feb 9, 2012 at 6:44 PM

Did you look at that code then?

Feb 9, 2012 at 7:07 PM

Yes, but I want to make it render from templates and the problem is that the templates from folder "Views/Shared/DisplayTemplates" folder don't get picked up as it says in a "How to make Templated Helpers to Display Data in ASP.NET MVC tutorial : The display templates in the Views\Shared\DisplayTemplates folder will be used by all controllers"....and I thought it's an Orchard thing, because if I try this in a standalone mvc 3 project it works...or maybe I'm doing something wrong:S


Feb 9, 2012 at 7:09 PM

I guess that doesn't work in Orchard and you'll have to do it the Orchard way then ;)