Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

FileExplorer / Client-side Events

  
  
  
  
  
  
  
  
  
  
  
Max file size allowed:
200.00 KB
File extensions allowed:
*.jpg, *.jpeg, *.gif, *.png

  • Client-Side Events

    The RadFileExplorer control provides the following client-side events:

    • OnClientCreateNewFolder - fired before creating of a new folder
    • OnClientDelete - fired before deleting a file
    • OnClientFileOpen - fired before opening a file
    • OnClientFolderChange - fired before changing the active folder
    • OnClientFolderLoaded - fired after loading the active folder
    • OnClientItemSelected - fired after selecting an item
    • OnClientLoad - fired after the control is initialized
    • OnClientMove - fired before an item is moved.
    • OnClientCopy - fired before an item is copied to the new destination directory.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.FileExplorer.ClientSideEvents.DefaultCS" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag runat="server" ID="Headtag1"></qsf:HeadTag>
    </head>
    <body class="BODY">
        <form id="form1" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
        <telerik:RadScriptManager ID="ScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <script type="text/javascript">
            //<![CDATA[
            function OnClientFolderLoaded(sender, args)
            {
                LogEvent("Grid folder loaded: " + args.get_item().get_name());
            }
            function OnClientFileOpen(sender, args)
            {
                LogEvent("Item open: " + args.get_item().get_name());
            }
            function OnClientItemSelected(sender, args)
            {
                LogEvent("Item click: " + args.get_item().get_name());
            }
            function OnClientFolderChange(sender, args)
            {
                LogEvent("Tree folder change: " + args.get_item().get_name());
            }
            function OnClientDelete(sender, args)
            {
                LogEvent("Delete: " + args.get_item().get_name());
            }
            function OnClientCreateNewFolder(sender, args)
            {
                LogEvent("Create new folder: " + args.get_newPath());
            }
            function OnClientMove(sender, args)
            {
                LogEvent("Item moved to: " + args.get_newPath());
            }
            function OnClientLoad(sender, args)
            {
                LogEvent("File Explorer loaded!");
            }

            function OnClientCopy(sender, args)
            {
                // args.set_cancel(true);
                var destinationDirectoryPath = args.get_newPath();
                LogEvent(String.format("Item is copying to {0}", destinationDirectoryPath));
            }

            function LogEvent(text)
            {
                var d = new Date();
                var dateStr = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
                var eventConsole = $get("eventConsole");
                eventConsole.innerHTML += "[" + dateStr + "] " + text + "<br/>";
            }
            //]]>
        </script>
        <table cellspacing="10">
            <tr>
                <td>
                    <telerik:RadFileExplorer
                    runat="server"
                    ID="FileExplorer1"
                    Width="450"
                    EnableCopy="true"
                    OnClientCreateNewFolder="OnClientCreateNewFolder"
                    OnClientDelete="OnClientDelete"
                    OnClientFileOpen="OnClientFileOpen"
                    OnClientFolderChange="OnClientFolderChange"
                    OnClientFolderLoaded="OnClientFolderLoaded"
                    OnClientItemSelected="OnClientItemSelected"
                    OnClientLoad="OnClientLoad"
                    OnClientMove="OnClientMove"
                    OnClientCopy="OnClientCopy">
                        <Configuration ViewPaths="~/FileExplorer/Examples/Default/Images/Northwind/" UploadPaths="~/FileExplorer/Examples/Default/Images/Northwind/"
                            DeletePaths="~/FileExplorer/Examples/Default/Images/Northwind/" />
                    </telerik:RadFileExplorer>
                </td>
                <td>
                    <div id="eventConsole" class="module" style="height: 470px; width: 300px; overflow: auto;">
                    </div>
                </td>
            </tr>
        </table>
        <qsf:Footer runat="server" ID="Footer1" />
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451