user715079
user715079

Reputation: 71

Get or set AjaxControlToolkit HTMLEditor content via javascript

I have an aspx file that uses HTMLEditor and Tabs of AjaxControlToolkit. The code is below


                </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
    </ajaxToolkit:TabPanel>
    <ajaxToolkit:TabPanel runat="server" ID="panelBanner" HeaderText="Banner">
        <ContentTemplate>
            <asp:UpdatePanel ID="updatePanelBanner" runat="server">
                <ContentTemplate>
                    <cc1:MeritAjaxEditor runat="server" ID="editor_BANNER" Height="350px" ActiveMode="Preview"
                        ReadOnly="true" />

                </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
    </ajaxToolkit:TabPanel>
    <ajaxToolkit:TabPanel runat="server" ID="panelPOS" HeaderText="POS">
        <ContentTemplate>
            <asp:UpdatePanel ID="updatePanelPOS" runat="server">
                <ContentTemplate>
                    <cc1:MeritAjaxEditor runat="server" ID="editor_POS" Height="350px" ActiveMode="Preview"
                        ReadOnly="true" />

                </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
    </ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>

What i need is to set the content of each editor through javascript function. I already tried the $get and $find methods but i cant find the editor.

var editorControl = $get("<%=editor.ClientID%>").control; //1. For setting content: editorContorl.set_content("Sample Content");

Please let me know if you know how to get the editors

Upvotes: 2

Views: 2339

Answers (1)

Harsh Baid
Harsh Baid

Reputation: 7249

If you are using HTML Editors then try using this:

var controlid = '<%=editor.ClientID%>';
var control = $find(controlid)._editPanel._modePanels[0];
control.insertHTML('test html message');

Reference link ASP.NET Forum

Thanks & Regards,

Harsh Baid

Upvotes: 1

Related Questions