This project is read-only.

Modifying Layout.cshtml elements with data from content item?

Topics: Customizing Orchard, General, Writing themes
Oct 3, 2011 at 6:08 PM

Sorry if the wording is a little vague; I'm still learning how to word my questions regarding Orchard. Basically, I have a field in Page that needs to set a class on the main <section> area defined by Layout.cshtml, but within Content-Page.cshtml. So far, the closest I can get is:


But that only hits the Content zone, and I need it above that. Is there any way to accomplish this without resorting to JS?

Oct 5, 2011 at 8:27 PM

Well, your layout will need a way to render that additional class. You could actually set that class on an expando of the layout object named any way you want, and then have the layout template read that from Model and inject the value into the rendering. Makes sense?