views:

303

answers:

1

i would like to create a library of custom EditorTemplates and DisplayTemplates. How do I "load" these into my MVC application? I want to be able to re-use my custom template library across a variety of MVC apps.

A: 

I don't think there is a way to "share" a library of editor or display templates between apps. Except for primitive types like date and int, your templates will be dependent on your Model data, so you probably only want to create a common library for those primitive types. That would be better implemented as a set of HTML Helpers.

Dave Swersky
Thanks for the response. What if I had a property like SSN or a Phone Number that needed a special editor/display template? I could reuse those across different MVC applications. As I understand it, you can set the "UiHint" attribute or the "DataType" attribute to control what editor/display template is used. It seems like if you can tell it which one to use, then there's the necessity to be able to reuse templates across apps. What am I missing? Thanks for your help.
tschreck