RadEditor Losing Viewstate Dynamically Created

4 posts, 0 answers
  1. Mark Wells
    Mark Wells avatar
    38 posts
    Member since:
    Jul 2012

    Posted 07 Aug 2012 Link to this post

    I am presently upgraing our Telerik controls and am having a problem with the RadEditor (ASP.NET AJAX) not retaining the viewstate on postback.
    We add the editor dynamically, so that we have an editor for each language that is enabled in our application. We add the editors in the Page_Init event. We only show on at a time. For example if we English and French enabled then there will be 2 editors on the page, but only one will show to the user. The user can change the language by choosing a value from a dropdown which then postsback to then show the other editor. This has worked fine in the past.

    Now though, if the user does not change the language and just enters text into the editor, then the content of the editor showing is blank when the page is submitted. If the user changes the language (and thus does a postback) and then clicks save, the viewstate is retatined.

    Any ideas for a workaround, or better yet, an actual fix?
  2. Rumen
    Rumen avatar
    14422 posts

    Posted 10 Aug 2012 Link to this post


    I am not aware of the reported problem.

    For some reason the editor content is not submitted when the page is submitted. To fix this, you need to manually save the editor content before the submit. If you are submitting the page using a Submit button, add an OnClientClick property for the Submit button:

    <asp:Button ID="btnSaveSign" runat="server" Text="OK" OnClientClick="saveEditorContent()" ...

    and add the saveEditorContent() JavaScript function on your page:

    <script type="text/javascript">
    function saveEditorContent()

    If this does not help, please, isolate the problem in a simple runnable project and send it for examination. I will debug it and provide a solution after replicating the issue. Please, also specify which is the version you have upgraded from?

    Best regards,
    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.
  3. Mark Wells
    Mark Wells avatar
    38 posts
    Member since:
    Jul 2012

    Posted 10 Aug 2012 Link to this post

    Hi Rumen,

    The saveContent() function works well and I am going to go with that. I was doing something similar with saving to a hidden field but your solution is much cleaner.

    I found another spot where I had just dropped the editor into the markup and had a similar problem where the view state was getting lost on submit buttons. The submit buttons were outside the update panel that the editor was in. Maybe you guys want to try and recreate the problem in that situation (it happens in IE9 but not compatability mode).
  4. Mark Wells
    Mark Wells avatar
    38 posts
    Member since:
    Jul 2012

    Posted 10 Aug 2012 Link to this post

    Actually, I take back saying that saveContent() works well. That function strips the <a href> tags out. Back to my original solution........
Back to Top