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

Rename/Delete Root Folder in RadFileExplorer

3 Answers 170 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 29 Nov 2010, 04:42 PM
After looking around in some other threads and trying myself I am unable to rename or delete the top most node in the treeview. I have read that this is disabled but is there a way to enable this feature? I am currently using a custom DBContentProvidor so allowing the end user to rename the root nodes should be possible.

3 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 02 Dec 2010, 12:10 PM
Hello James,

The root nodes cannot be deleted in RadFileExplorer control and this is by design and cannot be changed. In your case I recommend you to use this approach in order to achieve a similar result:
  • Hide the actual root nodes using this code:
    <script type="text/javascript">
        function OnTreeViewLoad(oTreeView, args)
        {
            for (var i = 0; i < oTreeView.get_nodes().get_count(); i++)
            {
                var node = oTreeView.get_nodes().getNode(i);
                node.get_element().firstChild.style.display = "none";
            }
        }
    </script>
  • The OnTreeViewLoad handler is attached to the RadTreeView's OnClientLoad event:
    RadFileExplorer1.TreeView.OnClientLoad = "OnTreeViewLoad";
  • You can hide the Line images using one of these approaches
    • Add this CSS to the page that host the RadFileExplorer: control
      <style type="text/css">
          div.RadTreeView .rtUL .rtLI .rtUL
          {
              padding-left: 0;
          }
               
          div.RadTreeView .rtUL .rtLI .rtUL .rtLI .rtUL
          {
              padding-left: 20px;
          }
      </style>
    • Or set the RadTreeView's ShowLineImages="false" property:
      RadFileExplorer1.TreeView.ShowLineImages = false;

For convenience I have attached a demo to the thread.

Greetings,
Fiko
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
James
Top achievements
Rank 1
answered on 06 Dec 2010, 12:14 PM
Hi Fiko,

Thank you for your response to my query. Although the information and example provided a re very useful it does not really address the issue in hand. I don't want to hide the root folders as these are relevant to the user. The user indeed has the ability to create these root folders so hiding them is not an option. 

Is there really nothing that can be overridden to enable the renaming/deleting of these root folders? Whilst I can understand the benefits of disabling this feature for true file explorers, I can not say the same for virtual directories created from a database.

I look forward to your response

James 
0
Fiko
Telerik team
answered on 09 Dec 2010, 01:35 PM
Hello James,

This behavior is by design and cannot be changed. In case that this is a major showstopper for you, you can use standalone controls (RadGrid, RadTreeView, etc.) in order to implement a replacement of the RadFileExplorer control.

Regards,
Fiko
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
FileExplorer
Asked by
James
Top achievements
Rank 1
Answers by
Fiko
Telerik team
James
Top achievements
Rank 1
Share this question
or