Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditorFor an int chooses a string template

i have two EditorTemplates

string.cshtml
int.cshtml

when i write EditorFor a string or an int they both choose string.cshtml

and when i even remove string.cshtml , the EditorFor for an int dont choose int.cshtml

like image 627
Nadeem Khedr Avatar asked Apr 19 '12 15:04

Nadeem Khedr


2 Answers

EditorTemplates use CLR typenames, not C# keywords.
You need to create Int32.cshtml.

like image 126
SLaks Avatar answered Oct 20 '22 07:10

SLaks


Your int template's name should be Int32.cshtml

The string.cshtml works because there is a CLR Type in System Namespace called String ;)

Your templates names must be called like the type you want.

More Information

  • ASP.NET MVC 2 Templates
  • Custom MVC Numeric EditorTemplate
like image 28
dknaack Avatar answered Oct 20 '22 07:10

dknaack