Home - Forums-.NET - FlyTreeView (ASP.NET) - Wrapping Text In Tree Node

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Wrapping Text In Tree Node
Link Posted: 08-Dec-2006 11:22
Is there a way to allow/force text to wrap within the tree nodes?  It would be nice to be able to do this at both the tree or and node level.  

Thanks,

Jamey
Link Posted: 09-Dec-2006 04:07
You can always use
within the Text property. There's no special attribute to make treeview nodes wrap by default. But there's DefaultStyle.CssClass (and other styles) property. You can use it to define word-wrap in some rule: .nodeStyle { white-space: normal; } DefaultStyle.CssClass = \"nodeStyle\";
Link Posted: 19-Dec-2006 14:06
I tried that, but it did not work.  When I look at the source code - the HTML, CSS and JavaScript - that is output by the FlyTreeView, I see the following style on every tree:

.nrf11_18 { white-space:nowrap;padding:0px; }

The numbers after the .nrf seems to change for each tree, but everything s else constant.  Every tree has this style and it appears to be set on the TD surrounding the text of the tree node. In your demo application at http://www.9rays.net/asp.net_2/treeview/Demo_Office2003.aspx, the style is specified as:

.nrf0_17 { white-space:nowrap;padding:0px; }

When I set the DefaultClass, the class declaration goes on the DIV inside the TD containing the nowrap spec.  The div doesn't seem to be able to override the nowrap style on the TD.
Link Posted: 19-Dec-2006 14:26
Yes, nrf css rules are used by treeview.

But nodeStyle (from my previous post) should override css styles from the nrf rule.

The FlyTreeView renders node content as
content


Anyway I'll try it here and report you.
Link Posted: 20-Dec-2006 00:17
Here the code that I've just tested and it seems to wrap:



    Untitled Page
    
        .myStyle { white-space: normal; }
    


Treeview implementation (notice DefaultStyle.CssClass attribute):

    ExpandLevel=\"2\" BorderColor=\"Silver\" BorderWidth=\"1px\" Height=\"330px\" Width=\"260px\"
    Padding=\"3px\" FadeEffect=\"True\">
    
                    Value=\"Personal Folders\">
            ....
            ....
        
    
            RowHeight=\"18px\" Font-Bold=\"true\" CssClass=\"myStyle\" BackColor=\"lightgray\" />
    



And result:

Link Posted: 01-Apr-2007 18:45
These examples don't work for me. I get a horizontal scrollbar at the bottom and the text still doesn't wrap.  I set the width to 100 for testing purposes.  Can someone please help?

Here is my aspx code:
            

                                    ImageSet=\"WinXP\" PostBackOnClick=\"true\"  Width=\"100\" OnSelectedNodeChanged=\"StoriesTreeView_SelectedNodeChanged\">
                                            BorderWidth=\"1px\" ForeColor=\"White\" ImageUrl=\"$winxp_folder_open\" Padding=\"0px;2px;2px;0px\" />
                    
                                            ImageUrl=\"$winxp_folder\" Padding=\"1px;3px;3px;1px\" RowHeight=\"16px\" />
                

Here is the CSS:
#left-nav
{
  float: left;
  width: 160px;
  padding-top: 2em;
  padding-left: 2em;
  background-color: orange;
  z-index: 1;
  overflow: hidden;
}
Link Posted: 01-Apr-2007 23:59
For version 4.2 or later please consider to add with style property to my example above:


    Untitled Page
    
        .myStyle
        {
            white-space: normal;
            width: 1%;
        }
    


This will make nodes to wrap text.
Link Posted: 16-Apr-2007 15:52
I am not able to get this wrap css code to work with IE7, suggestions?
Link Posted: 16-Apr-2007 18:14
Yes, IE7 has a different HTML layout model. So currently you can only wrap nodes by using
in the Text property of nodes. And also DefaultStyle.RowHeight is needed to be cleared. Anyway we're now working to get a more clean solution for the text wrap in IE7.
Link Posted: 17-Apr-2007 00:23
Thanks for the info.   Using BR is problematic, as it is difficult to know where to place the BR when loading dynamic content.  I look forward to a non-browser specific solution.  Thanks again for the info.