Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
public class CustomExplorerTree : ExplorerTree
{
public CustomExplorerTree() : base()
{
// Make sure the tree will load your own treebranch
// page, instead of the default
BranchUrl = Global.EPConfig.RootDir +
"templates/ExplorerTreeBranch.aspx";
}
protected override void RenderPageLink(PageTreeReader reader, bool isSelected, HtmlTextWriter output)
{
HyperLink htmlLink = new HyperLink();
htmlLink.ID = "page#" + reader.Page.PageLink.ToString() + "#link";
htmlLink.Text = reader.Page.Property["PageName"].ToWebString();
// Wrapper element for the link with a css class that
// handles wordwrap
HtmlGenericControl div = new HtmlGenericControl("div");
div.Attributes.Add("class", "wordwrapclass");
htmlLink.RenderControl(div);
div.RenderControl(output);
}
}
Create a templates/ExplorerTreeBranch.aspx file (just copy the Util/ExplorerTreeBranch.aspx) and change it so that your custom ExplorerTree is loaded:
<%@ Register TagPrefix="dev" Namespace="development" Assembly="EPiServerSample" %>
...
.wordwrapclass
{
word-wrap:break-word;
}
htmlLink.Text = reader.Page.Property["PageName"].ToWebString();
but if you change it to htmlLink.Text = reader.Page.PageName;
you can get it to work.