What is the location of the default Editor and Display Templates in Asp.net MVC3?

There are no default templates. Razor Editor and Display methods are extension methods of the class HtmlHelper. You can use them or you can develope your own extension methods, like this example.

Up vote 5 down vote favorite 1 share g+ share fb share tw.

Where are the default Razor Editor and Display templates (eg String. Cshtml, DateTime. Cshtml) located when one installs Asp.

Net MVC 3? Asp. Net-mvc-3 link|improve this question asked Oct 17 '11 at 9:36Ahmad3,2691721 73% accept rate.

(like for example @Html. DisplayFor(x=>x. Name) ) – Max Zerbini Oct 17 '11 at 9:42 @MaxZerbini - I plan on using these extensions.

I want to fiddle around with the complete default set of these templates. – Ahmad Oct 17 '11 at 9:45 1 These are not templates. These are extension methods of the object HtmlHelper.

You can use them or you can develope your extension methods. – Max Zerbini Oct 17 '11 at 9:57 They are not templates as Max Zerbini mentiones. You can however create them yourself by putting partials like String.

Cshtml in the Shared\EditorTemplates folder under Views. – Yngve B. Nilsen Oct 17 '11 at 10:21 @MaxZerbini please put your comment as an answer and I'll accept – Ahmad Oct 17 '117 at 7:13.

There are no default templates. Razor Editor and Display methods are extension methods of the class HtmlHelper. You can use them or you can develope your own extension methods, like this example.

Public static MvcHtmlString MyTextBoxFor(this HtmlHelper helper, Expression> expression) { MvcHtmlString result = InputExtensions. TextBoxFor(helper, expression); // do modification to result return result; }.

If you have DotPeek or Reflector you can look up the type DefaultDisplayTemplates in there you will find the templates. But be warned they are in Code format, not WebForm or razor format, so a bit more difficult 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 object1 { html.ViewContext.ViewData.ModelMetadata. Model }); return DefaultDisplayTemplates. StringTemplate(html); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions