Sitecore 5.0 API

State.AddRenderings Property

Gets an array list of renderings to add to the default list of renderings.

[Visual Basic]
Public Shared ReadOnly Property AddRenderings As ArrayList
[C#]
public static System.Collections.ArrayList AddRenderings {get;}

Property Value

An array list of renderingings.

Remarks

As the web engine renders a page, it builds a list of renderings to add to the page. Normally the renderings are fetched from the current item, but the AddRenderings State variable allows additional renderings to be rendered on the page.

Usually this is used in global.aspx to programatically add new renderings to a page based on certain conditions.

The list consists of either IDs or names of renderings.

The scope of the value is page and it is stored in the Items variable "SC_ADD_RENDERINGS".

Example

The following code add the SpotBox rendering to the page, and removes the Document rendering, id the user is logged into the extranet.

  public PersonalizePage() {
    if (ExtranetSecurity.IsLoggedIn) {
      State.AddRenderings.Add("SpotBox");
      State.RemoveRenderings.Add("Document");
    }
  }

See Also

State Class | Sitecore.Configuration Namespace | RemoveRenderings | DisableDefaultRenderings