gpt4 book ai didi

asp.net-mvc-3 - Asp.net MVC3 中默认编辑器和显示模板的位置是什么?

转载 作者:行者123 更新时间:2023-12-04 15:14:56 24 4
gpt4 key购买 nike

安装 Asp.Net MVC 3 时,默认的 Razor 编辑器和显示模板(例如 String.cshtml、DateTime.cshtml)在哪里?

最佳答案

如果您有 DotPeek 或 Reflector,您可以查找类型 DefaultDisplayTemplates在那里你会找到模板。但请注意,它们是代码格式,而不是 WebForm 或 Razor 格式,因此更难以解释。

字符串模板

internal static string StringTemplate(HtmlHelper html)
{
return html.Encode(html.ViewContext.ViewData.TemplateInfo.FormattedModelValue);
}

(我找不到默认的 DateTime 模板)

十进制模板
internal static string DecimalTemplate(HtmlHelper html)
{
if (html.ViewContext.ViewData.TemplateInfo.FormattedModelValue == html.ViewContext.ViewData.ModelMetadata.Model)
html.ViewContext.ViewData.TemplateInfo.FormattedModelValue = (object) string.Format((IFormatProvider) CultureInfo.CurrentCulture, "{0:0.00}", new object[1]
{
html.ViewContext.ViewData.ModelMetadata.Model
});
return DefaultDisplayTemplates.StringTemplate(html);
}

关于asp.net-mvc-3 - Asp.net MVC3 中默认编辑器和显示模板的位置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7791863/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com