4 Answers, 1 is accepted
0
tom
Top achievements
Rank 1
answered on 21 Mar 2009, 06:15 AM
Seems to be a very simple task.
Can anybody help me with this?
0
Hi Tom,
I would suppose that you are loading content in the editor programmatically, e.g. maybe by using editor.set_html()
To scroll back to the top please try the following code:
Best regards,
Tervel
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I would suppose that you are loading content in the editor programmatically, e.g. maybe by using editor.set_html()
To scroll back to the top please try the following code:
| //Set cursor to the top of the editor |
| window.setTimeout(function() |
| { |
| editor.setFocus(); |
| editor.fire("SelectAll"); |
| editor.getSelection().collapse(true); |
| }, 100); |
Best regards,
Tervel
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Murad Ajani
Top achievements
Rank 1
answered on 03 Nov 2009, 04:54 AM
Hi
I have a similar requirement but would need to detect the scroll position. I am using this control to display Terms & Conditions and the requirement is to force the user to scroll to the bottom of the control. For a multiline textbox, I had used the below code. Is there a similar properties with Editor control?
var txt = document.getElementById("<%=txtScroll.ClientId %>");
var height = txt.scrollTop;
txt.scrollTop = txt.scrollHeight;
if (txt.scrollTop != height){
txt.scrollTop = height;
alert("Please read the Service Agreement before Accept");
}
Thanks in advance
0
Hi Murad,
You can get a reference to the body element of the editor's document using the following code:
var editor = $find("<%=RadEditor1.ClientID%>");
var txt = editor.get_document().body;
Please, try the following solution:
Best regards,
Rumen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can get a reference to the body element of the editor's document using the following code:
var editor = $find("<%=RadEditor1.ClientID%>");
var txt = editor.get_document().body;
Please, try the following solution:
<telerik:RadEditor runat="server" ID="RadEditor1"> <content>dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br /> dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br />dsadadas<br /> </content></telerik:RadEditor> <input type="button" onclick="DetectScrollPosition();return false;" value="Detect Scroll Position" /><script type="text/javascript">function DetectScrollPosition(){ var editor = $find("<%=RadEditor1.ClientID%>"); var txt = editor.get_document().body; var height = txt.scrollTop; txt.scrollTop = txt.scrollHeight; if (txt.scrollTop != height){ txt.scrollTop = height; alert("Please read the Service Agreement before Accept"); } }</script>Best regards,
Rumen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
