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

Disabling node collapse at the client

1 Answer 63 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Lane
Top achievements
Rank 1
Lane asked on 27 Apr 2010, 07:09 PM
Hi,

I am using the TreeView control with checkboxes, with 2 levels of nodes. I like the tri-state for the checkboxes. The list I have is short and I'd like the treeview to always be expanded - I want to hide the plus image to the left of the top node to prevent the user from collapsing any of the top level nodes. How can I do this? Seems like it should be easy to do, but I can't find the property to set.

Thanks,

Jason

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2010, 06:01 AM

Hi Jason,

Add the following CSS on page in order to hide the expand/collapse images for treenode.

CSS:

 
    <style type="text/css">  
        .rtPlus  
        {  
            displaynone !important;  
        }  
        .rtMinus  
        {  
            displaynone !important;  
        }  
    </style> 

Also the following client code willhide the expan/collapse image for the root node.

JavaScript:

 
<script language="javascript" type="text/javascript">  
    function pageLoad() {  
        var treeView = $find("<%=RadTreeView1.ClientID%>");  
        var node = treeView.get_nodes().getNode(0);  
        var toggleElement = node.get_toggleElement();  
        if (toggleElement)  
            toggleElement.style.display = "none";  
    }   
</script> 

-Shinu.

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