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

RadFileExplorer grid refresh problem

1 Answer 139 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 03 Jun 2015, 08:37 PM

I'm having a problem with the grid of the RadFileExplorer not refreshing after I've created a new directory and added it to the viewpaths and treeview of the fileexplorer. What I'm trying to accomplish is to create a directory for a file to be uploaded by the RadFileExplorer, but I want to prefix the directory name with the current system date.  I'm using a RadTextBox to allow the user to enter the variable portion of the directory name. The fileexplorer grid will refresh as expected until after I create the new directory. Once I create the new directory, the grid does not refresh. I've searched for and found possible solutions in the forums, like using the clearFolderCache and refresh methods, but they did not work. Any Ideas?

The page element looks like the following:

<telerik:RadTextBox ID="RadDirSuffix" runat="server" OnTextChanged="RadDirSuffix_TextChanged" AutoPostBack="True" LabelWidth="64px" Resize="None" Width="160px"></telerik:RadTextBox>

Click on Upload to browse for the file you wish to upload.
<telerik:RadFileExplorer Runat="server" ID="RadFileExplorer1" OnItemCommand="RadFileExplorer1_ItemCommand" OnClientFolderChange="OnClientFolderChange" ></telerik:RadFileExplorer>

and the code behind is as follows:

protected void RadDirSuffix_TextChanged(object sender, EventArgs e)
{
RadTextBox tb = (RadTextBox)sender;
string userdir = "Safeco";
string targetdir = Properties.Settings.Default.TargetDirectory + "/" + userdir + "/" + FilePrefix.Text + tb.Text;

// Check to see if the directory exists and create it if not
if (!(Directory.Exists(Server.MapPath(targetdir))))
{
Directory.CreateDirectory(Server.MapPath(targetdir));
}

// point the telerik file explorer to the new directory
RadFileExplorer1.Configuration.ViewPaths[0] = targetdir;
RadFileExplorer1.Configuration.UploadPaths[0] = targetdir;
RadFileExplorer1.Configuration.DeletePaths[0] = targetdir;

// add new directory to treeview
RadTreeNode root = RadFileExplorer1.TreeView.Nodes[0];
RadTreeNode newDir = new RadTreeNode();
newDir.Text = FilePrefix.Text + tb.Text;
newDir.Selected = true;
root.Nodes.Add(newDir);
}

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 08 Jun 2015, 10:54 AM
Hi Tony,

The exprerienced issue is coming from the fact that the Page_Load event is the latest moment of the page life-cycle in which the FileExplorer's path can be configured, and so it is not bound property when its data is set into the TextBox's RadDirSuffix_TextChanged event handler.

We have already planned an improvement in the control allowing it to be configured in a later moment, and most probably it will be available for our up-coming official release.


Regards,
Vessy
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
FileExplorer
Asked by
Tony
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or