Reputation: 495
I am using Radeditor. i need to get the content from clip board and set to editor conten.
i am get the content. but i set the content to editor page, it shows empty.
i am using the following code.
var content = window.clipboardData.getData("Text");
if (content != null) {
editor.set_html = content;
so i try to bind the content in server side. so i called the server side function using pagemethods.i set EnablePageMethods ="true" in script manager.
but it shows page methods is undefined.
my first priority is set the content using java script.
How to do this?
Thanks,
Pooja
Upvotes: 0
Views: 6897
Reputation: 1160
you can use 2 different methods:
var editor = $find("<%=RadEditor1.ClientID%>");
var stringVal = window.clipboardData.getData("Text");
if(stringVal != null){
editor.set_html(stringVal); //replaces the content of the editor with stringVal
editor.pasteHtml(stringVal); //pastes your string val at the cursor (Defaults to end of the content window if no cursor found)
}
you can get the full API documentation here: http://www.telerik.com/help/aspnet-ajax/editor-pastehtml.html
Upvotes: 1
Reputation: 1127
Try Below Code:
var newValue = "control alt delete";
$find("<%=RadEditor1.ClientID%>").set_html(newValue);
Regards,
Dhaval Shukla
Upvotes: 4
Reputation: 11
RadEditor is a composite control and to get a reference to its client object you should use:
var editor = $find("<%=RadEditor1.ClientID%>");
var content = window.clipboardData.getData("Text");
if (content != null) {
editor.set_html = content;
Upvotes: 0