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);
}