I have a Web Text Editor in a template that has a maxlength and wondering if there is a way that I can return the characters remaining back to the user as they type?
Thanks,
Thanks! Worked like a champ. Thanks for the help.
Hello mnmjones,
try with the following code:
<head runat="server"> <title></title> <script type="text/javascript" id="igClientScript1"><!-- function WebTextEditor1_KeyDown(sender, eventArgs) { ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebTextEditor"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.TextEditorKeyEventArgs"></param> //Add code to handle your event here. var remainingChars = document.getElementById('RemainingChars'); var currentLength = sender.get_value().length; var result = sender.get_maxLength() - currentLength; remainingChars.innerHTML = result; }// --> </script></head><body> <form id="form1" runat="server"> <div> <ig:WebTextEditor ID="WebTextEditor1" runat="server" MaxLength="30"> <ClientEvents KeyDown="WebTextEditor1_KeyDown" /> </ig:WebTextEditor> <div id="RemainingChars" /> <ig:WebScriptManager ID="WebScriptManager1" runat="server"> </ig:WebScriptManager> </div> </form></body>
I hope this helps
Thanks Hristo, I did look at that last week but if I am correct, it only gives me the location of the cursor. What I can't figure out is how to get the count of characters in the control. Other than that, I will be able to use the same functionality that the sample is offering.
Hello mnmjones,there is no built-in functionality, you have to make it by yourself. Try to implement it with javascript. Look at this sample, it has almost the same functionality: http://samples.infragistics.com/2010.3/WebFeatureBrowser/contents.aspx?showCode=true&t=WebEditors/WebTextEditor_Basic.aspx~srcview.aspx?path=~srcview.aspx?path=WebEditors/WebTextEditor_Basic.src