So i’m playing around with Sitecore these days, and i wanted to create a generic navigation rendering that i can reused for both primary and secondary navigation.
One of the issues i ran into was how i can pass settings into my SubLayout, but it turns out it’s actually pretty easy.
Here’s how it’s done when you have a SubLayout based on a Usercontrol.
1 | var sublayout = ((Sitecore.Web.UI.WebControls.Sublayout)this.Parent); |
Now you can access your parameters via the paramenters collection.
I parsed a css-class to my navigation, and i accesed it like this:
1 | if (parameters["class"] != null) { |