Gets or sets the ID or name of a custom layout to use for the current page request.
The ID or name of the custom layout.
The default layout can be overridden by setting the custom layout before the web engine starts (typically in Page_Init or a page handler). This can be used to build the layout programatically in conjunction with AddRenderings and RemoveRenderings.
The scope of the value is page and it is stored in the Items variable "SC_CUSTOM_LAYOUT".
The following example builds a special layout if the user is a special user.
public void BuildVIPLayout(string user) {
if (user == "VIP") {
State.CustomLayout = "VIP layout";
State.AddRenderings.Add("VIPRendering");
}
void Page_Init() {
BuildVIPLayout(myUser);
}
}
State Class | Sitecore.Configuration Namespace