MVC编辑器/显示模板的官方“如何”?

时间:2022-12-12 11:21:40

I have been using MVC Editor & Display Templates for a while, but have come to realize that there seems to be very little official documentation on MVC Editor/Display Templates (Html.EditorFor() and Html.DisplayFor()). I found the basic MSDN documentation just showing the technical details (which on their own, are not very helpful), but I'm looking more for an official how-to, sort of like this example.

我使用MVC编辑器和显示模板已经有一段时间了,但是我逐渐意识到在MVC编辑器/显示模板(Html.EditorFor()和Html.DisplayFor()上似乎很少有官方文档。我发现了基本的MSDN文档,只是显示了技术细节(它们本身并不是很有帮助),但是我正在寻找一个正式的指南,类似于这个例子。

Are Editor/Display Templates more of an afterthought, and not really widely enough used to justify more in-depth official documentation?

编辑器/显示模板是否只是事后的考虑,并没有广泛地用于更深入的官方文档?

Or, am I blind, and what I'm looking for exists, I just haven't found it yet?

或者,我是盲目的,我所寻找的存在,我只是还没有找到它?

3 个解决方案

#1


3  

Official documentation? Don't know any off hand, but I know there are a ton of examples. In particular, I like Phil Haack's discussion on model binding to lists. It includes an example for an editor template in a pretty complicated example. There's source code there, too.

官方文档吗?我不知道,但我知道有很多例子。我特别喜欢Phil Haack关于模型绑定到列表的讨论。它在一个非常复杂的示例中包含一个编辑器模板示例。那里也有源代码。

Since he's co-authored every MVC Wrox book, I consider him a pretty definitive source:

因为他是所有MVC Wrox书籍的合著者,所以我认为他是一个非常确定的来源:

http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

Here's another blog post (non-official) in a similar vein:

以下是另一篇类似的博文(非官方的):

http://blogs.msdn.com/b/stuartleeks/archive/2010/03/30/collections-and-asp-net-mvc-templated-helpers-displayfor-editorfor.aspx

http://blogs.msdn.com/b/stuartleeks/archive/2010/03/30/collections-and-asp-net-mvc-templated-helpers-displayfor-editorfor.aspx

#2


3  

best article that I have found for it is:

我为它找到的最好的文章是:

http://www.growingwiththeweb.com/2012/12/aspnet-mvc-display-and-editor-templates.html

http://www.growingwiththeweb.com/2012/12/aspnet-mvc-display-and-editor-templates.html

It explains how to create DisplayFor and EditorFor templates really well.

它很好地解释了如何为模板创建DisplayFor和editorayfor。

#3


1  

ASP.NET MVC have a lot of materials on http://www.asp.net/mvc with different examples. EditorTemplates and DisplayTemplates is spetial folders for models (like here Quick Tips About ASP.NET MVC – Editor Templates) and you asking about html helpers, not templates.

ASP。NET MVC有很多关于http://www.asp.net/mvc的资料,有不同的例子。编辑器模板和显示模板是模型的大小文件夹(如这里关于ASP的快速提示)。NET MVC -编辑器模板)和您询问html帮助器,而不是模板。

#1


3  

Official documentation? Don't know any off hand, but I know there are a ton of examples. In particular, I like Phil Haack's discussion on model binding to lists. It includes an example for an editor template in a pretty complicated example. There's source code there, too.

官方文档吗?我不知道,但我知道有很多例子。我特别喜欢Phil Haack关于模型绑定到列表的讨论。它在一个非常复杂的示例中包含一个编辑器模板示例。那里也有源代码。

Since he's co-authored every MVC Wrox book, I consider him a pretty definitive source:

因为他是所有MVC Wrox书籍的合著者,所以我认为他是一个非常确定的来源:

http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

Here's another blog post (non-official) in a similar vein:

以下是另一篇类似的博文(非官方的):

http://blogs.msdn.com/b/stuartleeks/archive/2010/03/30/collections-and-asp-net-mvc-templated-helpers-displayfor-editorfor.aspx

http://blogs.msdn.com/b/stuartleeks/archive/2010/03/30/collections-and-asp-net-mvc-templated-helpers-displayfor-editorfor.aspx

#2


3  

best article that I have found for it is:

我为它找到的最好的文章是:

http://www.growingwiththeweb.com/2012/12/aspnet-mvc-display-and-editor-templates.html

http://www.growingwiththeweb.com/2012/12/aspnet-mvc-display-and-editor-templates.html

It explains how to create DisplayFor and EditorFor templates really well.

它很好地解释了如何为模板创建DisplayFor和editorayfor。

#3


1  

ASP.NET MVC have a lot of materials on http://www.asp.net/mvc with different examples. EditorTemplates and DisplayTemplates is spetial folders for models (like here Quick Tips About ASP.NET MVC – Editor Templates) and you asking about html helpers, not templates.

ASP。NET MVC有很多关于http://www.asp.net/mvc的资料,有不同的例子。编辑器模板和显示模板是模型的大小文件夹(如这里关于ASP的快速提示)。NET MVC -编辑器模板)和您询问html帮助器,而不是模板。