New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Expand all nodes inside the RadTreeView of a RadFileExplorer on page load


Product RadFileExplorer for ASP.NET AJAX


The solution below provides an example of how to expand all treeview nodes on load of the FileExplorer control.


RadFileExplorer is using callbacks to populate the expanded nodes. To expand all nodes of the tree you need to handle the TreeView's ClientNodePopulated client-side event and to manually expand the sub-nodes of the currently expanded node.

Here is an example:

<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientLoad="OnClientLoad">
    <Configuration ViewPaths="~/Images" UploadPaths="~/Images" />
<script type="text/javascript">
    function OnClientLoad(explorer, args) {
        var tree = explorer.get_tree();//get reference to the TreeView
        tree.add_nodePopulated(nodePopulated);//attach ClientNodePopulated handler
        expandSubNodes(tree);//manually expand initially visible nodes
    function nodePopulated(sender, args) {
        var currentNode = args.get_node();//get reference to the expanded node
    function expandSubNodes(parent) {
        var nodes = parent.get_allNodes();//get an array of all sub-nodes
        for (var i = 0; i < nodes.length; i++) {
In this article