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:
Thanks if you can help.
14 Answers, 1 is accepted
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
Please, see the following KB article on the subject: RadEditor Content Not Saved After Ajax Update in Firefox, Google Chrome and Safari.
the Telerik team
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.
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:
//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.
the Telerik team
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:
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" />
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
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
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.
the Telerik team
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.
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.
the Telerik team
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.
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.
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.
RadEditor losing content in IE11 in asp.net.
<telerik:RadEditor ID="txtAllergenWarning" runat="server" EditModes="Design" ToolbarMode="Default" Width="400px" Height="100px" MaxTextLength="1000" ContentAreaMode="Div" ContentFilters="None" ></telerik:RadEditor>
Have you tried the proposed solutions at RadEditor Content Not Saved After Ajax Update in Firefox, Google Chrome and Safari? They are applicable for IE11 too.
If yes and the problem still persists, please provide the whole page and its codebehind for examination.
The issue could be also related to overriding the editor content in your Page_Load method. Please note that if you read the content of the editor in an event handler (such as a button event handler) this event handler executes later in the page lifecycle compared to Page_Load. This is why, in case you set the initial content in Page_Load it is mandatory to add a !Page.IsPostBack check, e.g.
RadEditor1.Content = "Some content";