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

Last Reply one month ago By dharmendr

Posted one month ago

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>
Posted one month ago

Hi mukesh1,

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>

 


Posted one month ago Modified on one month ago

 

 <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" />