RadFileExplorer grid refresh problem

2 posts, 0 answers
  1. Tony
    Tony avatar
    7 posts
    Member since:
    Apr 2015

    Posted 03 Jun 2015 Link to this post

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

  2. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 08 Jun 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top