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

Root Path Deletion

2 Answers 41 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 25 Aug 2010, 03:39 PM
With the Rad Editor for ASP.NET Ajax, the behavior when attempting to delete a root path is different than with the older Rad Editor version we are upgrading from.

In the old version, attempting to delete the root folder displays the message "A root folder may not be deleted".

In the latest version, a confirmation dialog is displayed, just like when deleting any other folder.  When OK is clicked however, the folder is simply not deleted, but no error message is displayed.

I realize I can modify the permission on the root folder to disable the delete button, but this seems like it should be built in.

Thanks. Josh

The following a sample application that will reproduce the issue (note you should have a folder in your web root called images_root).

<%@ Page Language="C#" AutoEventWireup="true" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadEditor ID="RadEditor1" runat="server">
            <ImageManager ViewPaths="~/images_root" UploadPaths="~/images_root" DeletePaths="~/images_root" />
        </telerik:RadEditor>
    </div>
    </form>
</body>
</html>

2 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 26 Aug 2010, 02:50 PM
Hi Joshua,

Since RadControls for ASP.NET AJAX Q1 2009 RadEditor dialogs are using RadFileExplorer to provide the file browsing functionality. By design, RadFileExplorer does not allow deletion of the root folder but the confirmation dialog that is displayed is called before the server-side DeleteDirectory method.

It is possible to intercept the execution of the delete and show a custom JavaScript alert by assigning event handler to the OnClientDelete event as explained in this forum thread.

In order to implement this functionality  for RadEditor you need to modify the built-in dialog FileBrowser.ascx - more information about how to modify RadEditor's built-in dialog is available in this live demo.

For your convenience I have attached a sample project.

Best wishes,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joshua
Top achievements
Rank 1
answered on 26 Aug 2010, 03:27 PM
Thanks for the full explanation.  I feel comfortable with the suggested modification with the exception of identifying if the folder being deleted is the root folder.  However I am sure I can figure that out.

Josh
Tags
Editor
Asked by
Joshua
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Joshua
Top achievements
Rank 1
Share this question
or