Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
How can add textchange event to WebHtmlEditor
posted

Hi All,

I need a help..

We are using Infragistics WebHtmlEditor.

Requirement is that, user should not able to enter more than 100 character.When user enter, hundred and first character , the vent should be cancelled and a alert message to user.

So, I tried adding

WebtmlEditor.Attributes.Add("onchange","htmlEditor_TextChanged();");But its not working.I can also use key press event for this. But with this problem, on copy and pasting its doesnt work..

Can anybody help on this?

Thanks in advance, 

 

  • 7694
    posted

    Hello,

     From ClientSideEvents tag of WebHtmlEditor you  can invoke javascript function WebHtmlEditor1_KeyDown.

    ...

    <ighedit:WebHtmlEditor ID="WebHtmlEditor1" runat="server">

    <ClientSideEvents KeyDown="WebHtmlEditor1_KeyDown" />

    </ighedit:WebHtmlEditor>

    ...

    The function will look like this:

       <script type="text/javascript" language="javascript">

        function WebHtmlEditor1_KeyDown(oEditor, keyCode, oEvent) {

                if (oEditor.getText().length > 100){

                                oEvent.cancel = true;

                }

        }

       </script>

    For more inforamtion about client side events you can see this link:

    http://help.infragistics.com/NetAdvantage/NET/2008.2/CLR3.5/