Wednesday, April 15, 2015

Telerik's Kendo Grid component with GridEditMode.Popup and TemplateName specified

When creating custom templates in MVC they have the be placed in a certain spot.
The locations searched are:
  • /Areas/AreaName/Views/ControllerName/EditorTemplates/TemplateName
  • /Areas/AreaName/Views/Shared/EditorTemplates/TemplateName
  • /Views/ControllerName/EditorTemplates/TemplateName
  • /Views/Shared/EditorTemplates/TemplateName
Display template paths would be the same, just with a /DispayTemplates/ in the path instead of /EditorTemplates/
Template names also have to match convention:
  • TemplateHint from ModelMetadata
  • DataTypeName from ModelMetadata
  • The name of the type
  • If the object is not complex: “String”
  • If the object is complex and an interface: “Object”
  • If the object is complex and not an interface: Recurse through the inheritance hiearchy for the type, trying every type name

http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html

No comments: