如何在 ASP.NET MVC 3 中创建自定义编辑器/显示模板? [英] How to create custom editor/display templates in ASP.NET MVC 3?

查看:26
本文介绍了如何在 ASP.NET MVC 3 中创建自定义编辑器/显示模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 ASP.NET MVC 中的不同数据类型制作自定义编辑器模板(与 Html.EditorFor() 一起使用),包括重写现有模板.最终目标是创建一个迷你框架,其中每个编辑器都支持有关更改的 javascript 通知,并且我可以向用户显示页面中存在未保存更改的消息.(也许已经存在一些东西?)

I would like to make custom editor templates for different data types in ASP.NET MVC (to use with Html.EditorFor()), including rewriting the existing templates. The ultimate goal is to create a mini-framework where each editor supports javascript notifications about being changed, and I can show a message to the user that there are unsaved changes in the page. (Maybe there's something existing already?)

我可以找到许多与此类模板问题有关的问题,但我找不到有关创建它们的教程或手册.他们去哪里?有什么特殊的语法吗?如何选择模板?模板中有哪些可用信息以及如何访问它?等

I can find many questions pertaining to problems with such templates, but nowhere can I find a tutorial or manual on creating them. Where do they go? Is there any special syntax? How does a template get selected? What information is available in the template and how do I access it? Etc.

那么 - 我在哪里可以找到有关这些模板的所有信息?

So - where can I find out all about these templates?

推荐答案

http://aspnet.codeplex.com/releases/view/58781 并查看默认源代码的外观.注意:这也适用于 MVC 4.

Check and download ASP.NET MVC 3 Futures on http://aspnet.codeplex.com/releases/view/58781 and see how the default source code looks. Note: this works for MVC 4 as well.

这篇关于如何在 ASP.NET MVC 3 中创建自定义编辑器/显示模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆