Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
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.