简体   繁体   English

ASP NET MVC 2 EditorFor和DisplayFor的模板

[英]ASP NET mvc 2 Template for EditorFor and DisplayFor

I would like to control or customise the output generated by DisplayFor and EditorFor so it doesn't render the default html css tags for example: ....... 我想控制或自定义DisplayFor和EditorFor生成的输出,因此它不会呈现默认的html css标签,例如:.......

I would like this to be for all views not just a type or system type? 我希望这适用于所有视图,而不仅仅是类型或系统类型? And what is the simplest solution? 什么是最简单的解决方案?

Any help would be appreciated. 任何帮助,将不胜感激。

You can always create a custom DisplayFor/EditorFor *.asxc file that resides in either Shared/DisplayTemplates or -/EditorTemplates , pass the relevant type to it and just render what you want . 您始终可以创建一个自定义 DisplayFor / EditorFor * .asxc文件,该文件位于Shared/DisplayTemplates or -/EditorTemplates ,将相关类型传递给它,然后仅呈现您想要的内容

Following article explains it in further details: 下一篇文章将对其进行详细说明:

(This introduces the DisplayFor method - EditorFor works exactly the same way) (这引入了DisplayFor方法-EditorFor的工作方式完全相同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM