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

Sorting folders

4 Answers 138 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 30 Apr 2012, 02:12 PM
I'm using a radfileexplorer to display a list of folders that have pdf files within them.  My folders are named for the year that pdf file is about so I have folders from 2005-2012. Within vs2008 it orders my folders from 2005 down to 2012 and that is how it displays in my radfileexplorer.   I need to have 2012 be the top folder going down to 2005 and i'm not sure how I can achieve this.

Instead of listing like this:
2005
2006
2007
.
2012

I need it to list like this:
2012
2011
2010
.
2005

Thank you for any help

4 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 02 May 2012, 03:12 PM
Jerry:

You can reference this forum thread for insights on how to sort the folders by name and descending:

Programmatically sort by filename

Add this JavaScript to your .aspx markup:
<script type="text/javascript">
function OnFileExplorerClientLoad(oExplorer, args)
{
    var masterTable = oExplorer.get_grid().get_masterTableView();
 
    masterTable.sort("Name DESC");
}
</script>

and wire it to the RadFileExplorer's "OnClientLoad" event:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" Height="500px" Width="804px"
    Skin="Forest" OnClientLoad="OnFileExplorerClientLoad">
    <Configuration SearchPatterns="*.*" MaxUploadFileSize="20480000" UploadPaths="~/Thumbs/"
        ViewPaths="~/Thumbs/" DeletePaths="~/Thumbs/"></Configuration>
</telerik:RadFileExplorer>

This will sort the folders and files displayed in the right side Grid Window by name in descending order.

Let me know if this helps!
0
Jerry
Top achievements
Rank 1
answered on 02 May 2012, 03:56 PM
jumpstart,

Thank you that worked for the right side.  How do I get the left side to be sorted the same way?
Can I have just the folders sorted descendingly but the files be sorted alphabetically?

Is there a way to hide the left side and not allow the users to view that?

Thank you
0
Richard
Top achievements
Rank 1
answered on 02 May 2012, 06:44 PM
Jerry:

Resorting the TreeView is more complex and is covered in this forum thread. You have to manually resort the list before passing it to the RadFileExplorer.Configuration.ViewPaths = viewPaths; assignment.

Hiding the TreeView is the easier option for you.

You can reference the FileExplorer/First Look online demo for an understanding of how to customize your RadFileExplorer instance. In this demo, you can see how to hide the TreeView.

Here's some C# code to assist:
using System;
using System.IO;
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
        RadFileExplorer1.VisibleControls = GetVisibleControls(); 

    }
 
    private Telerik.Web.UI.FileExplorer.FileExplorerControls GetVisibleControls()
    {
        Telerik.Web.UI.FileExplorer.FileExplorerControls explorerControls = 0;
 
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.AddressBox;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.Grid;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.Toolbar;
        //explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.TreeView;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.ContextMenus;
        return explorerControls;
 
    }
}

See the attached image for display.

Hope this helps!
0
Tc Blaize
Top achievements
Rank 1
answered on 14 Mar 2013, 02:08 PM
This worked for me.
Tags
FileExplorer
Asked by
Jerry
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Jerry
Top achievements
Rank 1
Tc Blaize
Top achievements
Rank 1
Share this question
or