Posting the RadEditor with jQuery

4 posts, 0 answers
  1. christopher willis
    christopher willis avatar
    47 posts
    Member since:
    Sep 2006

    Posted 22 Oct 2008 Link to this post

    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?


  2. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 22 Oct 2008 Link to this post

    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  

    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.
  3. christopher willis
    christopher willis avatar
    47 posts
    Member since:
    Sep 2006

    Posted 12 Nov 2008 Link to this post

    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");



    // the toggle forces textarea to sync with designer



    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?

  4. srinivasu
    srinivasu avatar
    2 posts
    Member since:
    Feb 2011

    Posted 03 Feb 2011 Link to this post

Back to Top