If you have DotPeek or Reflector you can find the type DefaultDisplayTemplates
, there you will find templates. But keep in mind that they are in code format, not WebForm or razor format, so itβs a little harder to interpret.
StringTemplate
internal static string StringTemplate(HtmlHelper html) { return html.Encode(html.ViewContext.ViewData.TemplateInfo.FormattedModelValue); }
(There was no default DateTime template that I could find)
DecimalTemplate
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); }
source share