Extending Link Manager

4 posts, 0 answers
  1. Sups
    Sups avatar
    24 posts
    Member since:
    Jul 2007

    Posted 29 Sep 2009 Link to this post

    Hello,

    I want to extend linkmanager usercontrol dialog of radeditor.
    I have added a button control in LinkManager.ascx. by setting the title etc as done for 'Insert button'....

    <input type="text" id="LinkURL" style="width: 222px;" />
    <button type="button" id="CustomButton" style="min-width: 80px; _width: 80px; margin-left: 8px;">
    <script type="text/javascript">
    setInnerHtml("CustomButton", localization["Custom"]); 
    </script
    </button>

    but when dialog opened the button's title is set as 'undefined'. How can this be acheived?

    Also, I want to pass some value to the usercontrol to decide whether to show or hide this new 'custom button'.
    I tried something in 'Page_PreRenderComplete' in which I have my RadEditor like ..

     Dim showcustom As Boolean = True
    Dim linkManager As Telerik.Web.UI.DialogDefinition = radEHtmlContent.GetDialogDefinition("LinkManager")
    linkManager.Width = "500"
    linkManager.Height = "300"
    linkManager.ClientCallbackFunction = ""... here can I pass the value of showcustom and how to read that in LinkManager.ascx to show/hide the 'custombutton'

    Quick reply will be of great help.

    Thanks  in advance.
    skelkar
  2. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 02 Oct 2009 Link to this post

    Hi Skelkar,

    Straight to the points:

    1) Currently, it is not possible to localize the newly added buttons in the external dialogs. You should do that manually set the button's title and name, e.g.

    <button type="button" id="Button1" title="My Button">My Button</button>

    2) To pass some information (argument) from the page with RadEditor to the link manager, you should override the LinkManager command and use the argument variable:

             <telerik:radeditor  
                ID="RadEditor1"  
                ExternalDialogsPath="~/EditorDialogs" 
                runat="server"
              </telerik:radeditor>  
             
            <script type="text/javascript"
            Telerik.Web.UI.Editor.CommandList.LinkManager = function(commandName, editor, commandArgs) 
            {    
                var dialogName = commandName == "DocumentManager" ? "DocumentManager" : "LinkManager"
                var argument = "aaaa" + Telerik.Web.UI.Editor.CommandList._getLinkArgument(editor); 
                Telerik.Web.UI.Editor.CommandList._getDialogArguments(argument, "A", editor, commandName); 
     
                var callbackFunction = Telerik.Web.UI.Editor.CommandList.getCallbackFunction(commandArgs, function(sender, args) 
                { 
                    var realLink = args.get_value(); 
                    //backwards compatibility 
                    if (!realLink) realLink = args.Result; 
                    if (!realLink) realLink = args.realLink; 
     
                    editor.pasteHyperLink(realLink, commandName); 
                }); 
                editor.showDialog(dialogName, argument, callbackFunction); 
                return false
            }; 
            </script>    

    After that to obtain the argument information open the \EditorDialogs\LinkManager.ascx file and use the clientParameters parameter of the clientInit function:


    clientInit: function(clientParameters) 
        { 
            this._clientParameters = clientParameters; 
             
            alert(clientParameters); 


    Kind regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sups
    Sups avatar
    24 posts
    Member since:
    Jul 2007

    Posted 02 Oct 2009 Link to this post

    Hello Rumen,

    Thanks for quick reply.
    I tried the code given in you reply but its giving me 'Object does not support property or method..' for these lines.

                Telerik.Web.UI.Editor.CommandList._getDialogArguments(argument, "A", editor, commandName); 
     
                var callbackFunction = Telerik.Web.UI.Editor.CommandList.getCallbackFunction(commandArgs, function(sender, args) 
                { 

    I checked in telerik documents and it did not give any results for getCallbackfunction or _getDialogArguments in Telerik.Web.UI.Editor.CommandList. Are these methods added in new version. I am using version '2008.2.826.20' of telerik.

    Also, when doing alert in LinkManager.ascx for Client Parameters it just gives 'object object'. Which property to use from ClientParameters to get the arguments passed?

    Please help in this.

    Thanks
    Skelkar
  5. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 07 Oct 2009 Link to this post

    Hi Skelkar,

    Yes, the provided solution applies to the latest Q2 2009 version of RadControls for ASP.NET AJAX. The dialogs of RadEditor was enhanced and you cannot use the solution with the old Q2 2008 version.

    My recommendation is to upgrade to the new version to achieve the required functionality.

    Kind regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top