Tag Archives: code

Passing properties into Sitecore sublayouts

I’ve run into multiple situations where I’ve wanted to reuse most of a Sitecore sublayout/control with only one or two differences in the control’s properties. For example,  this has happened when I have chunks of markup that are entirely identical … Continue reading

Posted in it | Tagged , , , , | 2 Comments

Sitecore FieldRenderer class attribute

I spent hours trying to figure out how to set the class attribute of images rendered with the Sitecore FieldRenderer. Unfortunately, the CssClass attribute does not work on the FieldRenderer control as it does on the Image WebControl. Long after … Continue reading

Posted in it | Tagged , , , | Leave a comment

Sitecore current date in preview mode

To access the currently selected DateTime in the content editor’s preview mode, instead of checking the query string, use

Also, be sure to check if the page is in preview mode first. In my case, I had a presentation … Continue reading

Posted in it | Tagged , , , | Leave a comment

A gem

I stumbled upon some puzzling code the other day. It makes me wonder, what sort of direction is your code going if this is what you end up with? Unnecessary code omitted (unlike the snippet) to increase clarity.

Posted in it | Tagged , , | Leave a comment