How to set RadDialogOpener's ViewPaths property by Client javascript or Ajax code

4 posts, 0 answers
  1. Roger Chen
    Roger Chen avatar
    3 posts
    Member since:
    Nov 2004

    Posted 15 Feb 2011 Link to this post

    I want to change RadDialogOpener's ViewPaths(Or UploadPaths) property by client javascript code, how can i do? When i user ajax code change the ViewPaths value, but it can't work?

    public static void ShowDocumentDialog(RadDialogOpener rdo, string sFolders, string sExts, string sClientCallbackFunction, int iMaxUploadFileSize)
    {
        string[] aFolder = sFolders.Split(',');
     
        FileManagerDialogParameters documentManagerParameters = new FileManagerDialogParameters();
        documentManagerParameters.ViewPaths = aFolder;
        documentManagerParameters.UploadPaths = aFolder;
        documentManagerParameters.DeletePaths = aFolder;
        documentManagerParameters.MaxUploadFileSize = iMaxUploadFileSize;
     
        if (!string.IsNullOrEmpty(sExts))
            documentManagerParameters.SearchPatterns = sExts.Split(',');  //{ "*.doc", "*.docx", "*.pdf", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.zip", "*.rar", "*.txt" };
     
        DialogDefinition documentManager = new DialogDefinition(typeof(DocumentManagerDialog), documentManagerParameters);
        documentManager.ClientCallbackFunction = sClientCallbackFunction;
        documentManager.Width = Unit.Pixel(694);
        documentManager.Height = Unit.Pixel(440);
     
        // Remove it if exist
        if (rdo.DialogDefinitions.ContainsKey("DocumentManager"))
            rdo.DialogDefinitions.Remove("DocumentManager");
     
        rdo.DialogDefinitions.Add("DocumentManager", documentManager);
    }


    thanks
  2. Rumen
    Admin
    Rumen avatar
    14011 posts

    Posted 17 Feb 2011 Link to this post

    Hello Roger Chen,

    The latest moment of the page live cycle where the RadFileExplorer's properties ViewPaths / DeletePaths / UploadPaths can be set is the Page_Load event. Note that the Button_Click event occurs after that.
    Your scenario can be implemented using the following approach approach:
    • You need to check which control causes postback
    • Then, change the paths based on the clicked button. Please note that you need to clear the old nodes in order to force the RadFileExplorer to repopulate its content.

    You can find here attached a sample working project that we prepared for this scenario.


    Best wishes,
    Rumen
    the Telerik team
  3. Roger Chen
    Roger Chen avatar
    3 posts
    Member since:
    Nov 2004

    Posted 07 Mar 2011 Link to this post

    I'm used RadDialogOpener, not RadFileExplorer, page code is
    <telerik:RadDialogOpener runat="server" ID="DialogOpener1" Language="zh-CN" Skin="Windows7">
    </telerik:RadDialogOpener>
    so, i can't set "RadFileExplorer1.TreeView.Nodes.Clear();" how can i do?
  4. Rumen
    Admin
    Rumen avatar
    14011 posts

    Posted 10 Mar 2011 Link to this post

    Hi Roger,

    You should register the external dialog of RadEditor, e.g.

    DialogDefinition imageManager = new DialogDefinition(typeof(ImageManagerDialog), imageManagerParameters);
    //If you need to customize the dialog then register the external dialog files
    imageManager.Parameters["ExternalDialogsPath"] = "~/EditorDialogs/";

    The EditorDialogs folder is available in the RadControls for ASP.NET AJAX installation and it contains the ImageEditor.ascx control. The code above is provided in this KB article:
    Using the Image and Document managers outside RadEditor.

    After registering the external dialogs add a usercontrol in the FileBrowser.ascx control which will allow you to get a reference to the Treeview control and clear its nodes using the FindRadControl function provided in this article: Displaying single upload control in the FileBrowser Upload manager.


    Best regards,
    Rumen
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top