This is a migrated thread and some comments may be shown as answers.
Sizing/wrapping child template content
1 Answer 30 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jordan
Top achievements
Rank 1
Jordan asked on 28 Sep 2010, 07:05 PM

I am new to web development, my appologies if this question is basic or off topic.

How can I set a width for the content of leaf nodes in a tree.  For example, below the list of products scrolls off the screen and a scrollbar is visible at the bottom of the page. Is there a way to set a width and have the text wrap.  Setting Html width properties on the template or on the treeview .HtmlAttributes() method do not seem to work.

 

 

<% Html.Telerik().TreeView()

    .Name(

 

"Merchants")

 

 

    .HtmlAttributes(

 

"width=100")

 

 

    .BindTo(Model, (item, merchant) =>

    {

        item.Text = merchant.Name;

        item.Content = () =>

        {%>

 

            <div>

 

                <ul>

 

 

                    <li>Products: <%: string.Join(", ", merchant.Products) %></li
                
</ul
            
</div>

 

        <%};

    })

    .Render();

%>

 

 

Thanks for the help!

 

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 29 Sep 2010, 04:59 PM
Hi Jordan,

Though it is not advisable, you can enable text wrapping with the following HtmlAttributes:

    .HtmlAttributes(new { style = "width: 100%; white-space: normal" })

A better solution would be to let the content grow vertically, i.e.

    <div>
        <ul>
            <li>Products:
                <ul>
                    <% foreach (var product in merchant.Products) { %>
                        <li><%: product %></li>
                    <% } %>
                </ul>
            </li>
        </ul>
    </div>


Sincerely yours,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
Jordan
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or