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

Version 2010.2.826.40 BUG: Setting InitialPath raise "Invalid Character in folder name" alert

3 Answers 120 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
AndreaT
Top achievements
Rank 1
AndreaT asked on 07 Sep 2010, 09:14 AM
Hi, i have just upgraded to 826 version and now i am getting the error above. Previous version worked good. I use telerik CDN for scriptmanager:

<add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" />
<add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" />

this simple page raises the error.

<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 
        <telerik:RadScriptManager runat="server" ID="Rsm1"></telerik:RadScriptManager>
        <telerik:RadSkinManager ID="SkinMngr" runat="server" Skin="Windows7"></telerik:RadSkinManager>
        <telerik:RadAjaxManager ID="MainAjaxMngr" runat="server"></telerik:RadAjaxManager>
        <telerik:RadFormDecorator runat="server" ID="Fd1" />
 
        <telerik:RadFileExplorer ID="Fexp1" runat="server" Width="520" Height="650" AllowPaging="false">
        </telerik:RadFileExplorer>
         
    </form>
</body>
</html>


code behind is

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            String basePath = "~/Repo2/";
 
            Fexp1.Configuration.ViewPaths = new string[] { basePath };
            Fexp1.Configuration.DeletePaths = new string[] { basePath };
            Fexp1.Configuration.UploadPaths = new string[] { basePath };
            Fexp1.InitialPath = basePath;
 
            Fexp1.Grid.PageSize = 25;
 
            Fexp1.EnableOpenFile = true;
            Fexp1.DisplayUpFolderItem = true;
            Fexp1.AllowPaging = true;
            Fexp1.EnableCreateNewFolder = true;
            Fexp1.VisibleControls = GetVisibleControls();
 
            Fexp1.Configuration.MaxUploadFileSize = 2 * 1024 * 1024;
        }
    }
 
    private FileExplorerControls GetVisibleControls()
    {
        FileExplorerControls explorerControls = 0;
        //explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.AddressBox;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.Grid;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.Toolbar;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.TreeView;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.ContextMenus;
        return explorerControls;
    }

If I do not set the InitialPath no error is raised.

Andrea

3 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 09 Sep 2010, 04:03 PM
Hi Andrea,

I have already answered your support ticket. For convenience I have pasted my answer here as well:

"I was able to reproduce the described error. Please note that this code will not work (the Repo2 folder will be selected, however, because this is the default behavior when the value set to the InitialPath property is incorrect or cannot be found) with any versions of the RadFileExplorer control:
RadFileExplorer1.InitialPath = "~/Repo2/";
The InitialPath property should contain the actual root directory instead of the ~ sign. This is the correct approach in order to set the InitialPath property:
RadFileExplorer1.InitialPath = Page.ResolveUrl("~/Repo2/Folder1");
Page.ResolveUrl returns a value like this one:
/FileExplorerWebSite/Root/Folder1/ where FileExplorerWebSite is the name of the web-site's root folder name.

Could you please apply the suggested solution and you will not experience the same error"



Regards,
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
0
AndreaT
Top achievements
Rank 1
answered on 09 Sep 2010, 05:01 PM
Hi,

thank you. It worked. Good. Just a final  thought: why not to have InitialPath behave exactly as ViewPaths, DeletePaths and UploadPath that accept relative pathes with ~ ? It sound a more coeherent design to me, it is code behind and it sounds reasonable to me.

Kind Regards
Andrea
0
Fiko
Telerik team
answered on 14 Sep 2010, 09:55 AM
Hi Andrea,

The InitialPath property is a part of the RadFileExplorer control, not a part of the FileBrowserContentProvider logic. Please note that, however, there are many different FileBrowserContentProviders, that may have different paths formats and many of them do not contain the ~ sign. This is why, we decided to leave the developer to specify the path (a real path to a file or folder) which is more appropriate in almost every scenario (when a Custom provider is used) and will not compromise the flexibility of the ContentProvider model.

I hope this information helps.

Regards,
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
AndreaT
Top achievements
Rank 1
Answers by
Fiko
Telerik team
AndreaT
Top achievements
Rank 1
Share this question
or