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

Show only folders in RadFileExplorer


In this article you will see how to configure RadFileExplorer to show only the folders inside the passed path to the end user.


Option 1

A way to achieve the described scenario is to show only the folders' tree to the users, by configuring the FileExplorer's VisibleControls property by removing the right grid view of the control:

<telerik:RadFileExplorer ID="FileExplorer1" runat="server" EnableCopy="true" VisibleControls="Toolbar,TreeView,ContextMenus,AddressBox">
    <Configuration ViewPaths="~/" DeletePaths="~/" UploadPaths="~/"/>

Option 2

Another possible approach, in case you want to keep visible both the TreeView and the Grid, is to handle the ExplorerPopulated server-side event event of RadFileExplorer. Inthis event you have access to all items bound to the grid, so you can remove the files from the items collection like follows:

<telerik:RadFileExplorer ID="FileExplorer1" runat="server" EnableCopy="true" OnExplorerPopulated="RadFileExplorer1_ExplorerPopulated">
    <Configuration ViewPaths="~/" DeletePaths="~/" UploadPaths="~/" />
protected void RadFileExplorer1_ExplorerPopulated(object sender, RadFileExplorerPopulatedEventArgs e)
    List<FileBrowserItem> items = e.List;

    if (e.ControlName == "grid")
        int i = 0;
        while (i < items.Count)
            if (items[i] is FileItem)
Protected Sub RadFileExplorer1_ExplorerPopulated(ByVal sender As Object, ByVal e As RadFileExplorerPopulatedEventArgs)
    Dim items As List(Of FileBrowserItem) = e.List

    If e.ControlName = "grid" Then
        Dim i As Integer = 0

        While i < items.Count
            If TypeOf items(i) Is FileItem Then
                i += 1
            End If
        End While
    End If
End Sub

See Also

In this article