The root page to read data from

Namespace:  EPiServer.Web.WebControls
Assembly:  EPiServer (in EPiServer.dll) Version: 6.0.530.0


[EditorAttribute("EPiServer.Web.WebControls.Design.PageReferenceTypeEditor, EPiServer.Design", 
	"System.Drawing.Design.UITypeEditor, System.Drawing")]
public virtual PageReference PageLink { get; set; }




This example shows how to assign a value to the PageLink property of the PageTree control through code. This code is a modified version of the UserControl prefix.ascx.cs code-behind file in the EPiServer sample site.

We cannot assign to the PageLink property in the Page_Load event as it will be to late for the control to see it. Instead we use the Control.Init event.

private void Page_Init(object sender, System.EventArgs e)
    // Set the tree to start at the site start page
    PageDataTree.PageLink = EPiServer.Core.PageReference.StartPage;

private void Page_Load(object sender, System.EventArgs e)
    //if (((EPiServer.PageBase)Page).CurrentPage["ListingContainer"] == null)
    //    MainBodyWidth = 410 + 170;
    // This is too late, we need to change the PageLink property in the Page_Init method
    // Pagedatatree1.PageLink = ((EPiServer.PageBase)Page).Configuration.StartPage;

private void InitializeComponent()
    this.Load += new System.EventHandler(this.Page_Load);
    this.Init += new System.EventHandler(this.Page_Init);

See Also