This is a migrated thread and some comments may be shown as answers.

Using <br/> tag in label control within TreeNode affects positioning of node in tree

2 Answers 23 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Theresa Repta
Top achievements
Rank 1
Theresa Repta asked on 04 Nov 2009, 05:35 PM
I'm trying to add a label control to a TreeNode at run time.

My logic is basically as follows:

RadTreeNode childNode = new RadTreeNode("text"); 
Label lbl1 = new Label(); 
lbl1.Text = "text <br/> and additional information"
childNode.controls.Add(lbl1); 
 
parentNodes.nodes.add(childnode); 
 

My problem is that when this renders, the first line of text no longer appears NEXT to the line indicating its position in the tree.  Instead, the entire node appears several spaces BELOW the tree view line.

so instead of looking like

+ -- Text
       and additional information

it looks like
+--
   
    Text
    and additional information

Is there any way to use a line break and still have the node appear next to the tree line?


2 Answers, 1 is accepted

Sort by
0
Theresa Repta
Top achievements
Rank 1
answered on 04 Nov 2009, 05:40 PM
Never mind...I just realized I had style="white-space:normal;" set in my tree.  Removing this fixes my display issues
0
kollam2003
Top achievements
Rank 1
answered on 28 Jan 2010, 01:22 PM
Another method is::
<NodeTemplate> 
                                        <asp:Label ID="lblMenuName" Style="white-space: normal; width: 180px" runat="server" 
                                            Width="210px" Text='<%#DataBinder.Eval(Container.DataItem,"MenuName")%>'></asp:Label></NodeTemplate

Tags
TreeView
Asked by
Theresa Repta
Top achievements
Rank 1
Answers by
Theresa Repta
Top achievements
Rank 1
kollam2003
Top achievements
Rank 1
Share this question
or