I have very strict naming conventions for my models and I am wondering if I can leverage this via display templates for common fields like - WebsiteUrl, IsActive, UpdateDate, InsertDate?
Is it possible to create a Display Template based on 开发者_开发知识库a property's name?
EDIT:
I am aware that I can achieve this using something like this:
@Html.DisplayFor(model => model.Farmer.WebsiteUrl, "WebsiteUrl")
I am just wondering if there is a more strongly typed way of doing it.
you can use the UIHint("") attribute on your models, the name is the name for the file within your shared/EditorTemplates folder. i do this for things like upload box, jquery datepicker, WYSIWYG editor etc
精彩评论