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

get html content of DotNetNuke custom module html editor using jQuery

3 Answers 119 Views
Editor
This is a migrated thread and some comments may be shown as answers.
kamini
Top achievements
Rank 1
kamini asked on 19 Aug 2013, 10:31 AM
Hi

I have a DotNetNuke custom module where I am using an HTML editor. I have a input type checkbox and when i check\uncheck that checkbox, a jQuery method is called. I want the content of html editor in that method. How can i do that..?


<%@ Register TagPrefix="dnn" TagName="TextEditor"  Src="~/controls/TextEditor.ascx" %>
<div id="divCopyContent" >
<div id="divTab">
   <dnn:TextEditor ID="txtNotes" runat="server" Width="700px" />
</div>
<div class="copynote">
    <input class="chkCopyNote" type="checkbox" runat="server" id="chkCopyNote" />
     <asp:TextBox CssClass="customMessage" runat="server" ID="txtCustomMessage" TextMode="MultiLine" Height="100px" style="resize: none"></asp:TextBox>
</div>
</div>
<script type="text/javascript">
   jQuery(".copynote a").click(function () {
   var className = jQuery(this).attr('class');
            if (className.indexOf('true') != -1) {                        
      jQuery('#%=divCopyContent.ClientID%>').find(".customMessage").val(jQuery('#%=txtNotes.ClientID%>').val())
       }
       else {
                jQuery('#<%=divCopyContent.ClientID%>').find(".customMessage").val("");
            }
   });
</script>

i want to copy txtNotes' html content to txtCustomeMessage. 

Web.config settings

<dotnetnuke>
    <htmlEditor defaultProvider="RadEditorProvider">
      <providers>
        <clear />
        <add name="RadEditorProvider" type="Telerik.DNN.Providers.RadEditorProvider, Telerik.DNN.Providers.RadEditorProvider" providerPath="~\Providers\RadEditorProvider" AutoCreatePaths="true" ImagesPaths="Images,*PortalRoot*" />
      </providers>
    </htmlEditor>
</dotnetnuke>

Can anyone help me please...?

Thanks
Kamini

3 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 22 Aug 2013, 09:58 AM
Hi Kamini,

From the provided code I could guess that the editor is configured with an user control. This means that the ID you are using in the Client-side custom function is not the editor's ID, but that of the user control TextEditor.ascx. When a control is used with a user control its ID is dynamically created.

From this I could suggest you these approaches:
  • Using the Code-behind to find the editor's ID via the user control class;
  • Investigate the DOM with the browser's dev toolbar to find the text area of the editor and see the created ID. There is more information about this suggestion in this DNN forum thread;

On a side not I would like to inform you that the the RadEditor's provider is implemented by DNN's developer team and for more information on such matters you could post a message in their forum.

Regards,
Ianko
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
kamini
Top achievements
Rank 1
answered on 22 Aug 2013, 11:54 AM
Hi Ianko

Thanks for replying. I wanted it to be done from client side but its solved by using the code behind.

Thanks
Kamini
0
Ianko
Telerik team
answered on 26 Aug 2013, 04:09 PM
Hello Kamini,

If you need more information about the Client-side API, you could contact the DNN's support officers about how to get the dynamically generated ID and with it you could use our help documentation for further customizations.

Regards,
Ianko
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Editor
Asked by
kamini
Top achievements
Rank 1
Answers by
Ianko
Telerik team
kamini
Top achievements
Rank 1
Share this question
or