开发者

MVC 3 Razor - Create DisplayTemplate for specific Property Name e.g. WebsiteUrl, IsActive

开发者 https://www.devze.com 2023-03-29 05:08 出处:网络
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?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消