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

generic error when adding folders

1 Answer 36 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 01 Aug 2013, 12:32 AM
I downloaded and studied the example for implementing a DBContentProvider for the RadFileExplorer. Afterwards I decided to try my hand at it but have run into an issue that has me at a loss. When I add a subfolder to my root the file editor throws a generic windows.alert error messasge that simply displays the subfolder path. After dismissing the alert the file editor will refresh with the subfolder appearing in the right-hand grid...but it does not appear as a child node of the root in the treeview. If I click the 'refresh' button then everything is fine...the subfolder appears in both the treeview, as a child node of the root, and in the grid.

I opened both the example and my project in VS and set a breakpoints in the 'ResolveRootDirectoryAsTree' method of each. Running the repro steps I discovered that in my implementation the breakpoint is hit twice...once before the alert message box and a second after dismissing. Both times the path argument is 'Root/'. The same operation on the example code has the breakpoint being hit four times...
'Root/'
'Root/NewFolder/'
'Root/'
'Root/'

A close look at the 'DirectoryItem' generated in the method shows no differences...the full path and location properties of both the parent and it's child are the same for both my code and Teleriks. Tracing through the code shows nothing different either. So my question is this...where in the telerik code-base is this alert message being generated and what error condition is it intended to convey??

it is a standard window.alert message box with a title of "Message from webpage" and a subject of "Root/NewFolder/"...that's it, no error message, just the full path of the newly added subfolder.

BTW: to setup for debugging the issue I deleted all the example 'Items' but the root folder. Also my implementation uses LinqToSql to manage two tables...dbo.Directory and dbo.Content, rather than a single 'Items' table as the example does. For that reason posting code with this thread would be pointless.

Has anyone else seen this error dialog being thrown when adding a folder?? If so, any suggestions as to where to look??
-mark


1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 06 Aug 2013, 07:26 AM
Hello Mark,

I can only guess what might be causing the experienced issue, without seeing your implementation of the FileBrowserContentProvider. What I would suggest you is to debug the content provider and see which is the exact part of the code where the error is thrown.

Basically, this is what happens when you try to create a folder (I am giving you the logic from the provided by us DB content provider) - after the content provider's CreateDirectory is called, it checks what the value of the data server's CreateDirectory is:
DBContentProvider.cs
public
override string CreateDirectory(string location, string name)
{
    if (dataServer.ItemExists(String.Format("{0}{1}", location, name)))
        return "Directory with the same name already exists!";
 
    string error = dataServer.CreateDirectory(name, location);
    return !String.IsNullOrEmpty(error) ? String.Format("{0}{1}", location, name) : String.Empty;
}

If the result of the data server's create directory is an empty string, that means the directory has been created successfully, otherwise a popup with the path to the folder appears. This is why I assume that the file is successfully added to the database (since it is visible after a Refresh), but for some reason the content provider does not know that.

If the above insights are not helpful in solving the case, could you, please, prepare a sample fully runnable project including all the needed dependencies (content provider, Data base, etc.) so we could examine it on our side?

Looking forward to hearing from you,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
FileExplorer
Asked by
Mark
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or