RadEditor Iframe losing content across postback

13 posts, 0 answers
  1. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 17 Nov 2011 Link to this post

    Hello

    Could someone help to clarify the expected behaviour of the RadEditor content area after a postback? I have a RadEditor control with an Iframe content area, which is on a page with some other textbox controls that need to be validated server side. When the page is submitted for validation from a LinkButton, the validation occurs OK, but the content area loses its contents. Is this expected default behavior?

    I've done some research into this already, and I think I'm right in saying that this isn't due to the known issue of the 2010 release whereby the Iframe shows a similar problem when used with AJAX panels: I'm using the 2009 version, and also, it occurs even if an AJAX partial postback is not used on the page. Instead it seems that there is some sort of ViewState handling issue that I have not set up correctly. So working along these lines, my questions are:

    Is it possible/necessary to programmatically enable the viewstate for the IFrame content area? I have the ViewState property set on the radEditor control itself, but it seems this is not working automatically through the validation postback. Perhaps I am supposed to include some manual client side Javascript handling of the iframe contents or the editor viewstate in order to persist the contents of the content area? I haven't managed to find any other forum posts that address this issue, which makes me suspicious that I am missing something obvious. But if there are some posts about this issue, it would be great if someone could point me in the right direction. Presumably I don't need to set an id for the editors iframe, it looks as if this is generated automatically?

    Thanks if you can help.



  2. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 17 Nov 2011 Link to this post

    Just to add further details that I have since discovered, it appears that the iframe content does get automatically saved to the hidden textarea within the radeditor, it's just that the iframe does not get automatically repopulated with the contents of the hidden text area after the postback. Presumably this should work automatically if the editor control is wired up correctly?

    As a possible work around, is there anyway to 'loadcontent' manually with client side code, in the same way that you can call 'saveContent' on the editor control object?

    Thanks very much

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 17 Nov 2011 Link to this post

    Hi Paul,

    Please, see the following KB article on the subject: RadEditor Content Not Saved After Ajax Update in Firefox, Google Chrome and Safari.

    Best regards,
    Rumen
    the Telerik team
     
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
     
  5. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 25 Nov 2011 Link to this post

    Hi

    Unfortunately I've already been experimenting with all sorts of ways of trying to initiate the postback, along the lines of the suggestion you include. I have the older version of the RadControls toolkit though, which I believe is not affected by the bug in the link you provide, I'm still on the 2009 version running on NET 2.0 (life's just too short to attempt an upgrade, especially with all the alleged bugs I would apparently be faced with!)

    My code always works OK on the first serving of a page, but after a postback, specifically, during a server-side validation, no matter how I try to set the content of the editor, e.g. client side set_html, or server side [radEditorID].Content = ..... the original content never appears back in the content area window, it is always just blank. I don't think I should even have to save and reset the content manually like this, but obviously I had to go along this route, as I couldn't get any sort of ViewState to work for the Editor control either. Is it something to do with the server-side validation? I am using the RadEditor control in Iframe mode, and I have a RadAjaxPanel on the page too (though it is currently disabled in order to try and eliminate another variable).

    I'm so disappointed in this problem, it seems like such a basic thing to go wrong. I've been trying to fix this literally for weeks, not exactly what you would call productive!

    Thanks a lot.



  6. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 28 Nov 2011 Link to this post

    Hi Paul,

    Is it possible that the editor's original value overwrites the one submitted from the browser. This happens, for example, if you did not put the initial value setting in a if block checking whether the page is postback. Here is what you should do in your Page_Load method:

    If (!Page.IsPostBack)
    {
    //Set the editor content from database here
    }

    You can replace RadEditor with an Asp:TextBox and try to reproduce the problem. You should also replace the Content property of RadEditor with the Text property of the textbox control.

    If the problem is other, please isolate it in a sample working project and send it for examination via a support ticket. We need to reproduce the problem so that we can debug it and see what is causing it.

    Best regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  7. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 30 Nov 2011 Link to this post

    Hi

    I came to the understanding that this behaviour was due a bug in the control being triggered when it is rendered in Firefox, after moving the radEditor control using client side code to a new location in the DOM tree. I thought it was quite tricky to diagnose, so if it is any use to anybody else, there is another thread which includes a workaround solution here:

    http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-iframe-content-area-loses-css-styles-after-javascript-move-within-dom.aspx#1896240

    Cheers



  8. Graham MacLeod
    Graham MacLeod avatar
    7 posts
    Member since:
    Oct 2009

    Posted 04 Aug 2012 Link to this post

    I'm having very similar problem, with IE.  My RadEditor is in a RadWindow dialog.  It was working fine and then it stopped.  A simple ASP Textbox works fine, as does the RadEditor when I remove the RadAjaxPanel.  If I have the window ajaxified, the contents of the editor post back as blank.  I've played around with various suggested client-side scripts, but no luck.  My editor is NOT being reset anywhere in my code.  I've downloaded and upgraded to the 2012 Q2 release - problem is still there.

    Updating this post with the workaround.  It's not pretty, but it works and might help someone else.  Added an 'OnClicking' event to the RadButton, and also added an ASP:Hidden.  'OnClicking' stores the editor's get_html() to a variable and then sets the hidden field's value to this variable.  As I say, not pretty but so long as it works. 

         <telerik:RadButton ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Skin="Vista" Text="Submit" OnClientClicking="Clicking"  ></telerik:RadButton>

         <asp:HiddenField id="hidden_RadEditorNotesContent" runat="server" />

                <script type="text/javascript">
                    function Clicking()
                    {
                        var editor = $find("<%= RadEditorNotes.ClientID %>");
                        var notes = editor.get_html();
                        var hidden = document.getElementById("hidden_RadEditorNotesContent");
                        hidden.value = notes;
                        // alert("The value of the hidden notes are: " + hidden.value);
                        //  this didn't work
                        // editor.set_html(editor.get_html());
                    };
                </script>
            </telerik:RadCodeBlock>
  9. Graham MacLeod
    Graham MacLeod avatar
    7 posts
    Member since:
    Oct 2009

    Posted 05 Aug 2012 Link to this post

    Sorry, still not working - I'm now getting the following error:

    Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
    Details: Error parsing near 'TAPE
  10. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 07 Aug 2012 Link to this post

    Hello,

    Could you please open a support ticket from your account and provide a simple working project that demonstrates the problem? I will debug it after reproducing the issue and do my best to provide a solution.

    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  11. Majid
    Majid avatar
    1 posts
    Member since:
    Apr 2013

    Posted 05 Apr 2013 Link to this post

    Hi Rumen, 

    I'm running into the same issue on IE 8 with the 2012 Q3 release. Has this issue been resolved or is there a work around?

    I've a usercontrol that has a RadEditor on it. This user control is used on a page, which is called in the iframe of another page. I've a RadToolbar on the parent page. When I click on a toolbar button, and it does a postback, it seems the RadEditor gets rendered again and it loses any content that the user has entered. 

    If I place a RadButton on the page that has the usercontrol, then the RadEditor retains the user entered value correctly. It seems the issue is restricted to the case when the button is on the parent page. 

    Any help would be appreciated. 

    Thanks
  12. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 08 Apr 2013 Link to this post

    Hello Majid,

    Since there might be different reasons for this behavior, could you please open a support ticket from your account and provide a simple working project that demonstrates the problem? I will debug it after reproducing the issue and do my best to provide a solution.


    Regards,
    Stanimir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  13. margan
    margan avatar
    17 posts
    Member since:
    Oct 2010

    Posted 18 Jul 2014 in reply to Stanimir Link to this post

    Hi, has this issue been resolved?

    I'm using Q3 2013 release and I'm losing RadEditor content on postback also.
    I had a working user control with RadEditor in RadAjaxPanel. Now when I moved this control to iframe only RadEditor loses its content on postback.

    It seems that when I changed RadAjaxPanel to RadXmlHttpPanel it started to work but I would like to know what is the reason.

    Regards
  14. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 21 Jul 2014 Link to this post

    Hi Sebastian,

    In this thread many reasons for the content missing on post back behavior has been discussed and I can only assume what exactly is the behavior encountered on your end.

    The most commonly encountered issue is due to the usage of button that creates the post back. This matter is explained in this forum thread and possible solutions are provided. Note that this behavior is not a bug, but a browser behavior relate to the button element which does not raise the submit event and teh RadEditor cannot save its content properly to preserve it through post backs.

    Also, a common mistake that lead to the same behavior is when the content is being overridden in the code behind.

    If you still have issue, please send us a proper support ticked with more details provided, so that we could investigate the exact reason for the encountered issue.

    Regards,
    Ianko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017