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

RadEditor in RadWindow question

4 Answers 112 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Steve Holdorf
Top achievements
Rank 1
Steve Holdorf asked on 09 Dec 2010, 03:52 PM
Hi,

I am implementing the RadEditor in RadWindow code example into my application. In your example you are only displaying one RadEditor that is on the Default.aspx page in the RadWindow. In my case I have 8 RadEditors on the same Default.aspx page and I need to display each of them in the same RadWindow, only one at a time of course. I will show you the code I am using below. Please assist.

        DefaultCS.aspx:

        function SetEditorContent(content)
        {            
           $find(
"<%=MyRadEditorOnPage1.ClientID%>").set_html(content);  //set content to RadEditor on the mane page from RadWindow
       
}

        EditorInWindow.aspx

        function setContent(content)
    {
     var editor = $find("<%= editor1.ClientID %>");
         if (editor) editor.set_html(content); 
    }



How do I do this for MyRadEditorOnPage2 - 8? Would some kind of a switch() statment work?

Thanks,


4 Answers, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 10 Dec 2010, 05:06 PM
Hi Steve,

To implement this example's approach on a page with multiple RadEditor's you can have a global variable on the page to store the RadEditor's client-side object currently in use to get its reference in the SetEditorContent() function, e.g.:
var editorContent = null;
var enhancedEditor = null;
 
Telerik.Web.UI.Editor.CommandList["RichEditor"] = function (commandName, editor, args)
{
    editorContent = editor.get_html(true); //get RadEditor content
    enhancedEditor = editor;
    $find("<%=DialogWindow.ClientID%>").show(); //open RadWindow
};
 
 
function SetEditorContent(content)
{
    //set content to RadEditor on the mane page from RadWindow
    if (enhancedEditor)
        enhancedEditor.set_html(content);
}
.........


Regards,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Steve Holdorf
Top achievements
Rank 1
answered on 13 Dec 2010, 01:16 PM
Thanks for your reply. There still is a problem. Now, when you indicated that the last RadEditor used would retain the ecitorContent value that is correct. The problem is in the following code:

EditorInWindow.aspx

        function setContent(content)
    {
     var editor = $find("<%= editor1.ClientID %>");
         if (editor) editor.set_html(content); 
    }


Because I have eight editors on the same parent page as the single radwindow, when the new page with only one radwindow and radeditor open how does the setContent of the EditorInWindow.aspx page know which parent page editor to set the content to (i.e. editor1 editor2, editor3...)?

Thanks,


Steve Holdorf
0
Dobromir
Telerik team
answered on 15 Dec 2010, 04:52 PM
Hi Steve,

I am not quite sure I understand the problem.

The above mentioned JavaScript function is responsible to set the content from editor, which resides on the parent page, inside the RadEditor that is in the opened RadWindow. If you have multiple RadEditor's inside the RadWindow, you can use the same approach to pass the correct editor.

If this is not the case, could you please describe in more details what exactly you are trying to achieve?

Greetings,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Steve Holdorf
Top achievements
Rank 1
answered on 16 Dec 2010, 02:05 PM
Hi,

Our solution was to send the clientID of the radeditor as a querystring to the page's radwindow. I will make my posts more clear in the future.

Thanks,


Steve Holdorf
Tags
Editor
Asked by
Steve Holdorf
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Steve Holdorf
Top achievements
Rank 1
Share this question
or