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.

1 comment:

  1. Harrah's Resort Casino, Valley Center - Mapyro
    Harrah's 김포 출장샵 Casino, Valley 상주 출장마사지 Center. Phone: 강릉 출장마사지 (951) 357-8783. 화성 출장샵 Website: https://www.harrahsresort.com/. Location: Valley Center, West Valley Center, 제천 출장안마 CA