This is a migrated thread and some comments may be shown as answers.

Posting the RadEditor with jQuery

3 Answers 140 Views
Editor
This is a migrated thread and some comments may be shown as answers.
christopher willis
Top achievements
Rank 1
christopher willis asked on 22 Oct 2008, 06:46 PM
For various reasons, I'd like to use jQuery to post the radeditor content via ajax to a pagemethod.  I understand how to do this with jQuery, but I need some assistance with the radeditor. 

What I need to know is what do I need to do on the client and server to get the same exact results as a traditional postback?  In other words, I'd like to get the same exact string that I get from the RadEdit.Content property.

  • What javascript will put the contents of the editor into a form field so that jQuery can collect it and post it?
  • Assuming there is some processing done by the server-side radeditor control in a traditional postback on the posted HTML (encoding/decoding perhaps?), can I call that processing to get the same results in my pagemethod?

Thanks

3 Answers, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 22 Oct 2008, 07:54 PM

Hey Christopher,

Hmm, you should be able to do this by pulling out the Editor content with get_html(true).  The true is in there to apply any filters that may have been on the RadEditor previously, so that solves your second point.

As far as the syntax to do it, something like...

// Get instance of RadEditor, put value into variable  
var rEditValue = $find('<%= RadEditor1.ClientID %>').get_html(true);  
 
// Drop that value into your target item  
$('#targetID').html(rEditValue); 

Grabs the value of the content in RadEditor, true ensures filters are applied, then you $ it into the html of your target, provided it accepts html input.
0
christopher willis
Top achievements
Rank 1
answered on 12 Nov 2008, 06:08 PM
Thanks for that, but I'm actually trying to post the whole form with jQuery, instead of using the MS postback.

I found that there is a hidden textarea with the same name as the edit control.  It gets collected by the jQuery .serialize properly for the post.  This textarea contains the encoded content of the editor.  I found code to decode it in another post.

However, that textarea seesm to not be updated constantly.  I used this code to cause it to be updated to the most recent value in the editor:

 

var edtobj = $find("edt1");

 

edtobj.set_mode(2);

// the toggle forces textarea to sync with designer

 

edtobj.set_mode(1);

Do you know of more elegant code to casue that hidden textarea to be updated, other than toggling from html back to design like I did?

0
srinivasu
Top achievements
Rank 1
answered on 03 Feb 2011, 09:50 AM
thanks
Tags
Editor
Asked by
christopher willis
Top achievements
Rank 1
Answers by
Serrin
Top achievements
Rank 1
christopher willis
Top achievements
Rank 1
srinivasu
Top achievements
Rank 1
Share this question
or