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

RadFileExplorer Root file does not open

1 Answer 96 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Krish Singh
Top achievements
Rank 1
Krish Singh asked on 20 May 2010, 08:33 AM
Hi i am facing a problem when open root file its not open,

Here is my code:

<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="734px" Height="400px"
                        EnableOpenFile="true" OnExplorerPopulated="RadFileExplorer1_ExplorerPopulated"
                        VisibleControls="Grid,TreeView,ContextMenus,Toolbar">
                        <Configuration ViewPaths="~/UserData/FacilityFile/" DeletePaths="~/UserData/FacilityFile/"
                            UploadPaths="~/UserData/FacilityFile/" SearchPatterns="*.pdf" />
                    </telerik:RadFileExplorer>

protected void Page_Load(object sender, EventArgs e)
        {
                if (!IsPostBack)
                {
                    RadFileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomColumnsContentProvider).AssemblyQualifiedName;
                    RadFileExplorer1.InitialPath = Page.ResolveUrl("~/UserData/FacilityFile/" + Id.ToString() + "/");

                    string[] DocPaths = new string[] { RadFileExplorer1.InitialPath };
                    RadFileExplorer1.Configuration.ViewPaths = DocPaths;
                    RadFileExplorer1.Configuration.UploadPaths = DocPaths;
                    RadFileExplorer1.Configuration.DeletePaths = DocPaths;
                }
                InitializeComponent();            
        }
protected override void OnInit(EventArgs e)
        {
            RadFileExplorer1.Localization.SetString("Common_ConfirmDelete", "Are you sure you want to Delete?");
        }

        private void InitializeComponent()
        {
            DirectoryInfo nd = new DirectoryInfo(Server.MapPath("~/UserData/FacilityFile/" + Id.ToString()));
            if (!nd.Exists)
            {
                nd.Create();
            }
        }        

        protected void RadFileExplorer1_ExplorerPopulated(object sender, RadFileExplorerPopulatedEventArgs e)
        {
            //implement sorting for the custom Date column
            string sortingColumn = e.SortColumnName;
            if (sortingColumn == "Date")
            {
                DateComparer dc = new DateComparer();
                e.List.Sort(dc);
                if (e.SortDirection.IndexOf("DESC") != -1)
                {
                    //reverse order
                    e.List.Reverse();
                }
            }
        }

        public class DateComparer : IComparer<FileBrowserItem>
        {
            int IComparer<FileBrowserItem>.Compare(FileBrowserItem item1, FileBrowserItem item2)
            {
                //treat folders separate from files
                DateTime date1 = DateTime.Parse(item1.Attributes["Date"]);
                DateTime date2 = DateTime.Parse(item2.Attributes["Date"]);
                if (item1 is DirectoryItem)
                {
                    if (item2 is DirectoryItem)
                    {
                        return DateTime.Compare(date1, date2);
                    }
                    else
                    {
                        return -1;
                    }
                }
                else
                {
                    if (item2 is DirectoryItem)
                    {
                        return 1;
                    }
                    else
                    {
                        return DateTime.Compare(date1, date2);
                    }
                }
            }
        }

        public class CustomColumnsContentProvider : FileSystemContentProvider
        {
            public CustomColumnsContentProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
                : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
            {
                // Declaring a constructor is required when creating a custom content provider class
            }
        }




1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 25 May 2010, 11:42 AM
Hi Krish,

I am not quite sure that I understood your problem. Could you please provide me with little bit more information about the issue? Do you get any error message?

It will be best if you open a new support ticket and send me a runnable project where i can reproduce the problem. I will check it and do my best to provide a working solution as soon as possible.


All the best,
Fiko
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.
Tags
FileExplorer
Asked by
Krish Singh
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or