We are having issues while clicking using mouse at the text end of webhtmleditor control, especially when control is loaded with huge html data.
I have tried using javascript to set cursor position to text end on webhtmleditor focusin event but it alwasy gives me error at the following line [text.createTextRange(); It says undefined], but if i use this with normal textbox it works fine.
I tried different properties of text range, nothing seems to work with this control. Please suggest if u have any better solution
function SetCursorToTextEnd() { var editor = iged_getById('<%=panelTo.ClientID%>'); var text = editor._ie ? editor._elem : editor._doc().body; //alert(text.innerText); if (text != null && text.innerText.length > 0) { //if (text.createTextRange) //{ var FieldRange = text.createTextRange(); FieldRange.moveStart('character', text.innerText.length); //FieldRange.moveEnd('character', text.innerText.length); FieldRange.collapse(); FieldRange.select(); //} } }
We are populating SPAN Html controls inside webhtmleditor.
example: webHtmlEditor1.Text = "<span id='I_1' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 1</span>;"; etc...
Hello Sai,
Thanks for the update on the thread.
Feel free to ask any questions on the WebHtmlEditor or if you require any furher assistance on the Infragistics controls.
Let me know if you have any questions with this matter. Thank you.
This issue is resolved.
http://blogs.infragistics.com/forums/p/14477/262125.aspx
This is just a follow up on the thread if you have any questions in regards to calling document.createRange(). In the attached sample demonstrates on moving the cursor at the end of the WebHtmlEditor's content.
For setting the cursor position at the end of the WebHtmlEditor's content you can call document.createRange() function. I have attached a sample that demonstrates the usage of moving the cursor at the end of the content by an html button click. Also I ran this using Internet Explorer 9.