A File Explorer is a file manager that provides a graphical user interface for accessing the file systems. C1FileExplorer for ASP.NET Wijmo brings to you a web control which fills the gap for a file management GUI for the web application. It allows your web application to access directories, similar to Windows Explorer and helps in organizing files and folders by performing all the basic file operations such as create, delete, rename, drag and drop. In this tutorial, you will learn how to setup a page with C1FileExplorer and how to use and implement the top 5 features. The Top 5 features of FileExplorer are:
By the end of this tutorial, you will learn how to use C1FileExplorer and create a Windows like file management view in your web application as depicted in the image below.
The first step in our Tutorial is to setup our application with C1FileExplorer.
Set Initial Path - Right click the C1FileExplorer control and select Properties. In the Properties Window, add the folder location to the InitPath property. For instance, set it to "~/Example". With C1FileExplorer, you can configure the file explorer to show which folders, and show what kind of files by following properties:
By default, the all path properties are set the same as InitPath and the SearchPatterns is set to .jpg,.jpeg,.gif,.png
When you run the project, C1FileExplorer appears as shown in the image below.
The C1FileExplorer provides many powerful functionalities such as creating a new folder, deleting, renaming or copying a folder, you can perform these actions through the tool bar or context menu, you can also do this with your keyboard and shortcut keys. When you right click the file or folder, a context menu like the one below will appear. All file operations are enabled by default but you can disable the Copy, New Folder and Open file operations.
To enable multiple file selection in FileExplorer, set the AllowMultipleSelection to True. You can also define shortcut keys for the control. The complete list of shortcuts are given here.
These are interesting features of FileExplorer. Generally, the Windows Explorer does not provide these options. However, with C1FileExplorer, you sort the list of files and folders by simply clicking the column header in the file browser. To filter files enter the name of the file you want to find in the filter textbox located at the top of the FileExplorer. The FileExplorer automatically filters out the files based on the alphabets entered, as shown in the image below.
C1FileExplorer supports Paging if there are too many items in the right grid view. To enable paging,
Following are some ways to customize appearance of C1FileExplorer :
C1FileExplorer1.VisibleControls = FileExplorerControls.AddressBox |
FileExplorerControls.TreeView | FileExplorerControls.ListView;
C1FileExplorer provides following client side events:
To subscribe to these events, simply create a JavaScript method and set the property to the function name. For instance, create the following function for OnClientFileOpened event:
function onClientFileOpened(evt, path) {
alert("FileOpened");
}
Set the OnClientFileOpened to "onClientFileOpened" function as:
OnClientFileOpened="onClientFileOpened"
A detailed sample on client side events is available here. For more related samples on C1FileExplorer, refer to our ControlExplorer demo.