Try our conversational search powered by Generative AI!

Line is not wrapping in ExplorerTree

Vote:
 
Hi. I have build an ExplorerTree(conference.aspx). My problem is that I need to get the lines in the ExplorerTree to wrap. Is it possible? The layout of my page is destroyed when there is no wrapping in the ExplorerTree. Is there anybody that has a solutioon to this problem? Magne Johansen
#12186
Dec 09, 2004 10:30
Vote:
 
Hi, I think you already got an answer from our support, but I answer it here anyway incase there are more people wondering about this. The ExplorerTree control cannot handle wordwrapping and since it does not support templated controls (yet) it can be hard to fix. But it *is* possible... You can write your own class that inherits from ExplorerTree and by using the right style attributes when rendering the HTML elements, you can get the tree to wordwrap text in the nodes. The custom ExplorerTree could look something like this: 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" %> ... ... Add the the wordwrapclass definition to a css file: .wordwrapclass { word-wrap:break-word; }
#13810
Jan 03, 2005 12:04
Vote:
 
Has someone tried this example and got it to work? I'm struggling with "An exception occurred while trying to create an instance of EPiServer.WebControls.ExplorerTree. The exception was "Object reference not set to an instance of an object." Please let me now if you got it to work! /Lars
#13811
Apr 18, 2006 13:30
Vote:
 
I had the same error htmlLink.Text = reader.Page.Property["PageName"].ToWebString(); but if you change it to htmlLink.Text = reader.Page.PageName; you can get it to work.
#13812
Apr 21, 2006 13:39
Vote:
 
Hello Henrik I have problem with code for adding the css -class to the control. I get this error: "cannot convert from 'System.Web.UI.HtmlControls.HtmlGenericControl' to 'System.Web.UI.HtmlTextWriter'" when the line "htmlLink.RenderControl(div);" is compiled. Any thougths on this error? /Lars
#13813
Apr 24, 2006 13:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.