Tuesday, April 28, 2015

Naming things right. Sitecore MVC with Glass.

I  have recently encountered a problem with Glass RenderLink method. Idea was simple. I had a template with a General Link field which I intended to render in a View. But the method did not work. No exceptions thrown, simply no rendering happening. After some digging around I noticed that in the codegen Glass file, in the interface that inherits from IGlassBase, the type of the field was incorrect. Instead of being


I was a custom project-specific one, name exactly what the template was named - "Link"


This template name "Link" is what caused the problem. Being so generic it caused Glass to assume it was a project custom type. Once the template was renamed (name should not be so generic) the field type was correct and the RenderLink method worked fine.


No comments:

Post a Comment