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

disable/enable breaks customDialog

4 Answers 70 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Echarbeneau
Top achievements
Rank 1
Echarbeneau asked on 24 Nov 2008, 08:08 PM
I have a working custom dialog box. However, when I disable the editor and later enable the editor the custom dialog will no longer work. The only work around that I have found is setting the editMode to Preview/All instead of enable/disable, but this is not ideal.

Both Q2 and Q3 versions have this issue. I am currently using the Q3, I upgraded with hopes it would fix the problem.

Regards,
Ed C.

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Nov 2008, 04:16 PM
Hi Echarbeneau,

I tried to reproduce the problem but unfortunately without success. You can see my test in the attached project as well as test my project. Could you please modify it so that I can reproduce the problem on my side?

Thank you in advance.


Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Echarbeneau
Top achievements
Rank 1
answered on 02 Dec 2008, 08:47 PM
Thank you for the prompt reply. I found the combination that causes failure.

The RadEditor is set to enabled = false by default.
The RadEditor is linked to a RadAjaxManager
Download Error Example
0
Accepted
Nikolay Raykov
Telerik team
answered on 05 Dec 2008, 05:03 PM
Hello Ed,

In order to get your custom dialogs to work you should register your script into the page when you make an AJAX request. This is done by using the ScriptManager's methods for registering script inside an UpdatePanel control. Here you can find more information about this control and these methods specifically:

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx

For your convenience I have attached your aspx page with the changes I made. In the button click event handler I register your script with the ScriptManager's RegisterClientScriptBlock method. You can use it as a reference in your project.

Kind regards,
Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Echarbeneau
Top achievements
Rank 1
answered on 05 Dec 2008, 08:48 PM
Thank you!

Update:
I was still having some issues with the final implementation. There were some additional features that I was trying to use such as editor.pastHTML and passing arguments between the dialog/editor. The best solution was using Scriptmanager.RegisterStartupScript on the Page_Load event. Thanks for pointing me in the right direction.

Below is example code that relates to the Telerix demo page found at Editor > Tools > Custom Dialogs
Dim script As String = "Telerik.Web.UI.Editor.CommandList[""InsertSpecialLink""] = function(commandName, editor, args){var elem = editor.getSelectedElement();" + _ 
"if (elem.tagName == ""A"") {editor.selectElement(elem);argument = elem;}  else {var content = editor.getSelectionHtml(); var link = editor.get_document().createElement(""A""); link.innerHTML = content; argument = link;}" + _ 
            "var myCallbackFunction = function(sender, args) { editor.pasteHtml(String.format(""<a href={0} target='{1}' class='{2}'>{3}</a> "", args.href, args.target, args.className, args.name)) };" + _ 
            "editor.showExternalDialog(" + _ 
            "'InsertLink.aspx'," + _ 
            "argument," + _ 
            "270," + _ 
            "300," + _ 
            "myCallbackFunction," + _ 
            "null," + _ 
            "'Insert Link'," + _ 
            "true," + _ 
            "Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move," + _ 
            "false," + _ 
            "false);" + _ 
        "};" 
        ScriptManager.RegisterStartupScript(MeGetType(Page), "InsertSpecialLink", script, True

Tags
Editor
Asked by
Echarbeneau
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Echarbeneau
Top achievements
Rank 1
Nikolay Raykov
Telerik team
Share this question
or