0

By default UiHint attribute is looking for template in Views/Shared/DisplayTemplates or Views/{Controller}/DisplayTemplate. I really need to put my templates in different path so I am looking for solution that will make this work. Is there any way to add some other location to search places?

Thanks.

Ali Adlavaran
  • 3,697
  • 2
  • 23
  • 47

1 Answers1

0

Actually as far as I know, you can't change UiHint's default location so instead you can simply set template this way:

@Html.DisplayFor(m => m.MyItem, "~/Views/Controller/DisplayTemplates/MyItem.cshtml")

Update: for having a template for your property you have three options:

Community
  • 1
  • 1
Sirwan Afifi
  • 10,654
  • 14
  • 63
  • 110
  • Oh, no please! :( i can't do this for every field in my project. Actually on looking for templates, i want to say to the `RazorEngine` to look some other places before the defaults. this should be assignable in general way because maybe it be changed as a consequence of the my theme changed! – Ali Adlavaran Sep 12 '15 at 05:55
  • @AliAdlavaran So based on convention you have to put your template in those folders. – Sirwan Afifi Sep 12 '15 at 06:46