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

Need to change the expanded node style

3 Answers 108 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Balaji
Top achievements
Rank 1
Balaji asked on 08 Dec 2009, 09:18 AM
Hi

We are using ajax rad tree view in our application with custom skin. And there is a requirement to change the expanded node font size & font weight.

Please suggest me to get the solution

Thanks in advance,
Balaji Velasiri

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Dec 2009, 09:39 AM
Hallo Balaji Velasiri,

Try setting the font style from client side as shown below.

ASPX:
 
<telerik:RadTreeView ID="RadTreeView1" OnClientNodeCollapsed="OnClientNodeCollapsed" OnClientNodeExpanded="OnClientNodeExpanded" 
    runat="server"
    <Nodes> 
     . . . 
    </Nodes> 
</telerik:RadTreeView> 

JavaScript:
 
<script type="text/javascript"
    function OnClientNodeExpanded(sender, args) { 
        args.get_node().get_textElement().style.fontSize = "20px"// Set the font style 
        args.get_node().get_textElement().style.fontWeight = "bold"// Set the fonf style 
    } 
    function OnClientNodeCollapsed(sender, args) { 
        args.get_node().get_textElement().style.fontSize = "";  // Reset the style 
        args.get_node().get_textElement().style.fontWeight = "normal"// Reset the style 
    } 
</script> 

-Shinu.
0
Balaji
Top achievements
Rank 1
answered on 08 Dec 2009, 10:22 AM
Hi Shinu,

Thanks for your reply.

And is there any chance to achive the same through tree view custom style sheet ?

Thanks,
Balaji Velasiri

0
Balaji
Top achievements
Rank 1
answered on 16 Dec 2009, 07:02 AM
Hi

I have used the above suggested code. And it is working fine if we expand the node using mouse.

But I am expanding tree view node from separate button click including the normal node expanding nature(on button click I am calling the script to expand the tree view node e.g: treeView.get_selectedNode().expand()). In this case the OnClientNodeExpanded, OnClientNodeCollapsed events are not firing.

Is there any way to fire the OnClientNodeExpanded, OnClientNodeCollapsed events even if we expand the tree view node using client side script ?

Thanks in advance,
Balaji Velasiri



Tags
TreeView
Asked by
Balaji
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Balaji
Top achievements
Rank 1
Share this question
or