New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Show only folders in RadFileExplorer

Description

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

Solution

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:

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

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:

ASP.NET
<telerik:RadFileExplorer ID="FileExplorer1" runat="server" EnableCopy="true" OnExplorerPopulated="RadFileExplorer1_ExplorerPopulated">
	<Configuration ViewPaths="~/" DeletePaths="~/" UploadPaths="~/" />
</telerik:RadFileExplorer>
C#
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)
            {
                items.Remove(items[i]);
            }
            else
            {
                i++;
            }
        }
    }
}

See Also

In this article
DescriptionSolutionSee Also
Not finding the help you need?
Contact Support