Re: Error on call to GetDocument

  •  04-19-2010, 11:01 PM

    Re: Error on call to GetDocument

    Incognitobe:
    Hi Adam,
     
    thanks for the reply which sounds quite plausible and would certainly explain the error I´m getting, but I´m quite sure I got the ID right. Here´s a snippet from the html source of the table rendered by the editor (I omitted the style attribute):
     
    <table cellspacing="0" cellpadding="0" _IsCuteEditor="True" id="CE_ctl00_mcp_te_editor_ID" >
     
    and here is the part, where the initialize-method is called:
     
    <img [snip] onload="window.CuteEditorInitialize('CE_ctl00_mcp_te_editor_ID',{'_ClientID':'CE_ctl00_mcp_te_editor_ID' [snip] />
     
    so the ID does not seem to be the Problem.
     
    The Page containing the Editor is also containing a ScriptManager control which is used for several ajax-enabled features throughout the page. Might that have something to do with it?
     
    Thanks,
    Tobias
     
    Hi Tobias,
     
    Please try this example on your site.
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5. <html xmlns="http://www.w3.org/1999/xhtml">   
    6. <head runat="server">   
    7.     <title>Untitled Page</title>   
    8. </head>   
    9. <body>   
    10.     <form id="form1" runat="server">   
    11.         <CE:Editor ID="Editor1" runat="server">   
    12.         </CE:Editor>   
    13.         <input type="button" value="Change Color" onclick="changeColor()" />   
    14.     </form>   
    15. </body>   
    16. </html>   
    17.   
    18. <script>   
    19. var editor1=document.getElementById("<%= Editor1.ClientID %>");   
    20.   
    21. function changeColor()   
    22. {   
    23. var editdoc = editor1.GetDocument();   
    24. editdoc.body.style.backgroundColor="Red";   
    25. }   
    26.   
    27. </script>  

    Regards,
     
    Ken
View Complete Thread