0

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

Pooja
  • 495
  • 3
  • 9
  • 25

3 Answers3

4

Try Below Code:

var newValue = "control alt delete";
    $find("<%=RadEditor1.ClientID%>").set_html(newValue);

Regards,

Dhaval Shukla

Dhaval Shukla
  • 1,127
  • 2
  • 10
  • 19
1

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

Brian Garson
  • 1,160
  • 6
  • 11
0

http://www.telerik.com/community/forums/aspnet-ajax/editor/fill-content-through-javascript-in-telerik-editor.aspx

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;
saeedku
  • 11
  • 1