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

Css for parent node

1 Answer 123 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Asim Ali
Top achievements
Rank 1
Asim Ali asked on 02 Apr 2010, 06:16 AM
I am working on telerik treeview control and I want to display all the nodes that are parent in bold. The treeview is created dynamically as in the treeview is bound to a Sql Server database. How can I display the parent nodes in bold.

reply me at ur earliest
thanks
Asim Ali

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 02 Apr 2010, 02:35 PM
Hello Asim Ali,

I'm posting the reply to your support ticket for community reference.

To be able to make root nodes bold use the Javascript function below. The key is in choosing which of the nodes is a root node. That is achieved by the get_level property. It is 0 when the node is root:

Copy Code
<script type="text/javascript">
        function pageLoad() {
            var tree = $find("<%= RadTreeView1.ClientID %>");
            var nodes = tree.get_allNodes();
            for (var i = 0; i < nodes.length; i++) {
                if (nodes[i].get_level() == 0)
                {
                    nodes[i].set_cssClass("bold");
                }
            }
        }
    </script>

Here's the bold CssClass:

Copy Code
<style type="text/css">
    .bold
    {
       font-weight:bold;
    }
    </style>

For the exception that you receive when binding the RadTreeView you may find in my project a sample Binding to SQLDataSource. If you still need help could you please attach your code so we can be able to help you.

Greetings,
Veronica Milcheva
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
Asim Ali
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or