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

Last Reply 20 days ago By dharmendr

Posted 20 days 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>
You are viewing reply posted by: dharmendr 20 days ago.
Posted 20 days 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>