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

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

3 Answers 59 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Roger Chen
Top achievements
Rank 1
Roger Chen asked on 15 Feb 2011, 06:22 AM
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

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 Feb 2011, 05:25 PM
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
0
Roger Chen
Top achievements
Rank 1
answered on 08 Mar 2011, 02:40 AM
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?
0
Rumen
Telerik team
answered on 10 Mar 2011, 03:20 PM
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!
Tags
Editor
Asked by
Roger Chen
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Roger Chen
Top achievements
Rank 1
Share this question
or