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

DocumentManager open with DialogOpener javascript error

1 Answer 90 Views
Editor
This is a migrated thread and some comments may be shown as answers.
solutionfactory
Top achievements
Rank 1
solutionfactory asked on 14 May 2009, 03:36 PM
Hi all,
i have just updated the controls  from version Q3 2008  to version 2009.01.0506.35

When i open DocumentManager with DialogOpener object, a javascript error occurs.

In this snippet i set the DialogDefinitions for the DocumentManagerDialog
            targetFolder = _presenter.GetAttachmentsFolder(); 
 
            FileManagerDialogParameters dlgManagerParameters = new FileManagerDialogParameters 
                                                                   {ViewPaths = new string[1] {targetFolder}}; 
            dlgManagerParameters.UploadPaths = dlgManagerParameters.ViewPaths; 
            dlgManagerParameters.DeletePaths = dlgManagerParameters.ViewPaths; 
            dlgManagerParameters.MaxUploadFileSize = 5000000; 
            // If you don't set the following property, the default value will be used 
            dlgManagerParameters.SearchPatterns = 
                ConfigurationManager.AppSettings["allowedDocumentTypes"].Split(",".ToCharArray()); 
 
 
            DialogDefinition docManager = new DialogDefinition(typeof(DocumentManagerDialog), 
                                                               dlgManagerParameters) 
                                              { 
                                                  ClientCallbackFunction = "callBackFnAllegato"
                                                  Title = "Gestione documenti"
                                                  Width = Unit.Pixel(694), 
                                                  Height = Unit.Pixel(500) 
                                                  }; 
            docManager.Parameters["ExternalDialogsPath"] = "~/EditorDialogs"
            dlgOpener.DialogDefinitions.Add("DialogDocument", docManager); 
 

Dialog declaration
<telerik:RadDialogOpener runat="server" ID="dlgOpener"
        </telerik:RadDialogOpener>       
 


Open dialog
<asp:ImageButton ID="imgAllegatoManager" runat="server" SkinID="btnAttach"  
            OnClientClick="return ShowDialog('DialogDocument');" /> 


This is the embedded javascript that fails, specifically the first line of the function
_loadLinkProperties : function() 
    { 
        var currentLink = this._clientParameters.get_value(); 
        var currentHref = currentLink.getAttribute("href", 2); 
        var anchors = this._clientParameters.documentAnchors; 
 

This is the error:
Error: this._clientParameters.get_value is not a function
Source File: http://localhost:4137/ScriptResource.axd?d=UQWwKN_46q7-uyZ4WTiJtjbw7-TZ21nD4t1jm17a3wzrvCs8Hytb9miequru0VyFY8JL4lX41RPClwykw1ZqHw2&t=ffffffffc54d9c1d
Row: 1081



Any suggestions?

Thank in advance and
best regards.

Flavio




1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 16 May 2009, 01:42 PM
Hi,

The DocumentManager expects a certain object with arguments to be passed by the calling page. In your case you probably do not pass the correct arguments. Here is your 'ShowDialog' JavaScript method should look like:

<script type="text/javascript"
function ShowDialog(dlg) 
    var opener = $find("dlgOpener"); 
    var link = document.createElement("a"); 
    var arguments = {get_value: function(){return link;}, CssClasses: []}; 
    opener.open(dlg, arguments); 
    return false
function callBackFnAllegato(sender,args) 
    var link = args.get_value(); 
    var linkUrl = link.getAttribute("href",2); 
    alert(linkUrl); 
</script> 

The arguments needed are:

1. CssClasses - array with CSS classes to be shown in the dialog (for selecting the link CSS). If you do not need this feature, pass an empty array.
2. get_value() function - passes the link to be modified. If you are inserting a new link, simply create an empty anchor (document.createElement('a')).

Regards,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
solutionfactory
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or