How do I get the values from the "Parameters" field (second screenshot) in the code-behind of the sublayout?
I understand I can get/set parameters on a rendering (specifically sublayout) when it is added to the presentation details of an item, just as described here (Sitecore 6 - using parameters).
However I would like to use the parameters field from the layout definition item. In the codebehind of the file belonging to to layout definition I can cast the parent to a sublayout and that object also has a .Parameters
property, however this doesn't contain the values I'd expect.
This is the Page_Load
method in the control code-behind:
protected void Page_Load(object sender, EventArgs e)
{
var sublayout = ((Sublayout)this.Parent);
string rawParameters = Attributes["sc_parameters"];
NameValueCollection parameters =
Sitecore.Web.WebUtil.ParseUrlParameters(rawParameters);
//parameters contains values from "Additional parameters (first screenshot)
//I do not know the sublayout item id or sublayout path, so how do I get
//the values from the second screenshot?
}
Doublecheck still doesn't work, only additional parameters
are shown:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…