[Solved] ASP.Net TextBox KeyUp event not working with AjaxToolKit HtmlEditorExtendor

mukesh1
 
on Jun 03, 2021 02:33 AM
Sample_185240.zip
4008 Views

I have 1 textbox and 1 label.

on keyup event, i am calling javascript function and changed text of label also easily.

But if i used htmleditorextendor with textbox not understand how to achieve this here.

<script type="text/javascript">
    function copyText() {
        src = document.getElementById('<%=txtgreeting.ClientID%>').value;
        document.getElementById("ContentPlaceHolder1_lblAlumni4Name").innerHTML = src;

    }
</script>
<asp:TextBox ID="txtgreeting" TextMode="MultiLine" Rows="4" runat="server" onKeyUp="copyText()"></asp:TextBox>
<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1" EnableSanitization="false" TargetControlID="txtgreeting" runat="server">
</ajaxToolkit:HtmlEditorExtender>
Download FREE API for Word, Excel and PDF in ASP.Net: Download
mukesh1
 
on Jun 03, 2021 03:05 AM
on Jun 03, 2021 05:23 AM

 

 <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        Sys.Application.add_load(function () {
            var htmlEditorBox = $('.ajax__html_editor_extender_texteditor');
            htmlEditorBox.keyup(function () {                
                var d = document.getElementById("ContentPlaceHolder1_HtmlEditorExtender1_ExtenderContentEditable");               
                //alert(d.innerHTML);                
                document.getElementById("ContentPlaceHolder1_lblAlumni1Name").innerHTML = d.innerHTML;
               
            });
        });

 

<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1" EnableSanitization="false" TargetControlID="txtgreeting" runat="server"></ajaxToolkit:HtmlEditorExtender>
<asp:Label ID="lblAlumni1Name" runat="server" />
dharmendr
 
on Jun 03, 2021 05:14 AM
on Jan 23, 2022 07:10 AM

Hi mukesh1,

Use Sys.Application.add_load event.

Use below code.

HTML

<script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
    Sys.Application.add_load(function () {
        var htmlEditorBox = $('.ajax__html_editor_extender_texteditor');
        htmlEditorBox.keyup(function () {
            document.getElementById('<%=lblAlumni1Name.ClientID%>').innerHTML = this.textContent;
        });
    });
</script>
<asp:Label ID="lblAlumni1Name" runat="server" />
<asp:TextBox ID="txtgreeting" TextMode="MultiLine" Rows="4" runat="server" onKeyUp="copyText()"></asp:TextBox>
<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1" EnableSanitization="false" TargetControlID="txtgreeting" runat="server"></ajaxToolkit:HtmlEditorExtender>