How to assign the value of a div to a cute editor on client side?

Last post 10-28-2008, 2:08 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  10-24-2008, 4:49 AM 45075

    How to assign the value of a div to a cute editor on client side?

    Hello,
    I'm assigning a pragraph's innerHTML to my cute Editor on client side but its not accepting the data from pragraph. My whole page is as below:
     
                       
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Welcome to Quattro Html Editor</title>
        <script language="javascript" type="text/javascript">
                                function GetData(dvData)
                                {
                                    alert(document.getElementById(dvData).innerHTML);
                                    //document.getElementById('qtroEditor1').setHTML(document.getElementById(dvData).innerHTML);
                                    document.getElementById('<%=      qtroEditor1.ClientID%>').value=document.getElementById(dvData).innerHTML;
                                }
                            </script>
    </head>
    <body>
        <form id="frmOct20" runat="server">
        <CE:EDITOR id="qtroEditor1" runat="server" Height="150" Width="300" ShowBottomBar="false" ThemeType="Office2007" AutoConfigure="Minimal" EnableContextMenu="True" ></CE:EDITOR>
                            <input type="button" value="Edit 1" id="btnEdit" onclick="GetData('divData1')"/>
                            <input type="button" value="Edit 2" id="Button1" onclick="GetData('divData2')"/>
                            <input type="button" value="Edit 3" id="Button2" onclick="GetData('divData3')"/>
                           
                            <div id="divData1">
                                Block 1 <b>Data</b>
                            </div>
                            <div id="divData2">
                                Block 2 <b>Data</b>
                            </div>
                            <div id="divData3">
                                Block 3 <b>Data</b>
                            </div>
        </form>

    </body>
    </html>

  •  10-28-2008, 2:08 AM 45131 in reply to 45075

    Re: How to assign the value of a div to a cute editor on client side?

    Hi rizwanali,
     
    Please try this code:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Welcome to Quattro Html Editor</title>

        <script language="javascript" type="text/javascript">
                                function GetData(dvData)

                                {
                                    alert(document.getElementById(dvData).innerHTML);
                                    var MyValue=document.getElementById(dvData).innerHTML;
                                    document.getElementById('<%=qtroEditor1.ClientID%>').SetHTML(MyValue);
                                    
                                }
        </script>

    </head>
    <body>
        <form id="frmOct20" runat="server">
            <CE:Editor ID="qtroEditor1" runat="server" Height="150" Width="300" ShowBottomBar="false"
                ThemeType="Office2007" AutoConfigure="Minimal" EnableContextMenu="True">
            </CE:Editor>
            <input type="button" value="Edit 1" id="btnEdit" onclick="GetData('divData1')" />
            <input type="button" value="Edit 2" id="Button1" onclick="GetData('divData2')" />
            <input type="button" value="Edit 3" id="Button2" onclick="GetData('divData3')" />
            <div id="divData1">
                Block 1 <b>Data</b>
            </div>
            <div id="divData2">
                Block 2 <b>Data</b>
            </div>
            <div id="divData3">
                Block 3 <b>Data</b>
            </div>
        </form>
    </body>
    </html>

     
     
    Regards,
     
    Ken
View as RSS news feed in XML