Error in Editor1.GetDocument() function when called in javascript on aspx page

Last post 05-02-2006, 2:47 AM by sunderchhokar. 2 replies.
Sort Posts: Previous Next
  •  05-01-2006, 10:16 AM 18627

    Error in Editor1.GetDocument() function when called in javascript on aspx page

    When i write below code in ascx file it works fine but when i write below code in aspx page it thow error on second line i.e getDocument() is undefined.
     
    Line 1 .           var editor1=document.getElementById('<%=Editor1.ClientID%>');
     
     
    Line 2 .           var editdoc=editor1.GetDocument();
     
    Please help me.
     
    Please also tell me how i can get the content of Editor on the popup window.
     
    Chhokar, Sunder
  •  05-01-2006, 12:39 PM 18633 in reply to 18627

    Re: Error in Editor1.GetDocument() function when called in javascript on aspx page

    Chhokar,
     
    Can you paste your aspx code?
     
    >>Please also tell me how i can get the content of Editor on the popup window.
     
    The following example may help:
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  05-02-2006, 2:47 AM 18673 in reply to 18633

    Re: Error in Editor1.GetDocument() function when called in javascript on aspx page

    Hi,
     
    Here is my aspx code of popup window where i want to use cute editor content i.e (parent window).
     
     
    ---------------******************----------Code goes here------------------------------------**************************
     
    <%@ Page language="c#" Codebehind="SpellingForm.aspx.cs" AutoEventWireup="false" Inherits="CS_Example2.SpellingForm" %>
    <%@ Reference Page="OpenXEditor.aspx"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
     <HEAD>
      <title>SpellingForm</title>
      <SCRIPT LANGUAGE="JavaScript">
    // Copy the selected suggestion to the Change To field
    function onSuggestionChange() {
     var i = document.SpellingForm.SuggestionsLst.selectedIndex;
     document.SpellingForm.ChangeToTxt.value = document.SpellingForm.SuggestionsLst.optionsIdea [I].text;
    }
      function getEditorText()
      {
       debugger;
      
       alert("Hello");
        var editor1 = window.opener.document.forms[0].elements['PowerXEditor1:Editor1'];
       alert('Sunder');
       var editdoc = editor1.GetDocument();
       //alert(editdoc.body.innerHTML);
       var mystr = new String(editdoc.body.innerHTML);
       alert(mystr);
      }
      </SCRIPT>
      <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
      <meta name="CODE_LANGUAGE" Content="C#">
      <meta name="vs_defaultClientScript" content="JavaScript">
      <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
     </HEAD>
     <body onload="getEditorText();">
      <form id="SpellingForm" method="post" runat="server">
       <P>
       </P>
       <BR>
       <P></P>
       <HR width="100%" SIZE="1">
       <P align="center">
        <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="50%" bgColor="#ffffcc" border="0">
         <TR>
          <TD>
           <DIV align="center">
            <TABLE id="Table2" cellSpacing="1" cellPadding="1" width="80%" align="center" border="0">
             <TR>
              <TD>
               <asp:label id="ProblemDescriptionLbl" runat="server" Width="209px"></asp:label></TD>
              <TD>
               <asp:label id="ProblemWordLbl" runat="server" Width="289"></asp:label></TD>
             </TR>
             <TR>
              <TD>
               <asp:label id="Label1" runat="server" Width="209">Change to:</asp:label></TD>
              <TD>
               <asp:textbox id="ChangeToTxt" runat="server" Width="290"></asp:textbox></TD>
             </TR>
             <TR>
              <TD>
               <asp:label id="Label2" runat="server" Width="209">Suggestions:</asp:label></TD>
              <TD>
               <asp:listbox id="SuggestionsLst" runat="server" Width="290px" Height="110px"></asp:listbox></TD>
             </TR>
             <TR>
              <TD align="middle" colSpan="2">
               <TABLE id="Table3" cellSpacing="1" cellPadding="1" width="50%" border="0">
                <TR>
                 <TD>
                  <asp:button id="IgnoreBtn" runat="server" Width="97px" Text="Ignore"></asp:button></TD>
                 <TD>
                  <asp:button id="ChangeBtn" runat="server" Width="97px" Text="Replace"></asp:button></TD>
                 <TD>
                  <asp:button id="AddBtn" runat="server" Width="97px" Text="Add"></asp:button></TD>
                </TR>
                <TR>
                 <TD>
                  <asp:button id="IgnoreAllBtn" runat="server" Width="97px" Text="Ignore All"></asp:button></TD>
                 <TD>
                  <asp:button id="ChangeAllBtn" runat="server" Width="97" Text="Replace All"></asp:button></TD>
                 <TD>
                  <asp:button id="CloseBtn" runat="server" Width="97px" Text="Cancel"></asp:button></TD>
                </TR>
               </TABLE>
              </TD>
             </TR>
             <TR>
              <TD align="left" colSpan="2">
               <DIV style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px" align="left" ms_positioning="FlowLayout">
                <P align="center"><EM><FONT size="2">Context:</FONT></EM></P>
               </DIV>
               <asp:label id="ContextLbl" runat="server" Width="532px" Height="68px" BorderWidth="1px" BorderStyle="Solid" Font-Size="X-Small"></asp:label></TD>
             </TR>
            </TABLE>
           </DIV>
          </TD>
         </TR>
        </TABLE>
       </P>
      </form>
      <P><HR WIDTH="100%" SIZE="1">
     </body>
    </HTML>
    ---------------******************----------End for Code ------------------------------------**************************
     
     
View as RSS news feed in XML