Search code examples
c#asp.nettelerikradeditor

Disable postback of certain properties of Telerik RadEditor control


We have a page with Telerik RadEditor on a tab strip. There are scenarios when RadEditor contains a lot of html and when doing a post back in order to switch the tab, all its contents is being post back to the server. This results in gigantic performance loss (there are times when post backs are sending tens of MiB of data). Is it possible to tweak RadEditor in such a way that it does not send its contents over to server on postbacks? Our code-behind does not rely on RadEditors Content property accessor (does not read its content explicitly), only its mutator (its contents are set from within the control's code-behind). Is it even possible to do such things with any of Telerik controls and if it is, then how do we achieve such result?

It's worth pointing out that we use relatively old Telerik UI version (2013.2.611.35) and we can't switch to a newer version at the moment.

Thank you in advance.


Solution

  • Consider using the ContentUrl of the PageViews. This will let you load separate pages in iframes, so they will postback independently of the main page. Thus, you can have a standalone page with the editor and standalone pages for your other tabs.

    On the possibility to exclude something from the POST request - I don't know of a way to do this, as it is not supposed to happen. The whole point is to transfer the current page state to the server.

    Another option you may consider is using AJAX and the PageRequestManager's beingRequest event to try to blank out the editor. I have not tried it and I do not know whether it will actually work out, since so much data may simply be too much for the JS engine to process before the postback begins. Here is a bit of code that illustrates the idea:

            var currContent = null;
            function BeginRequestHandler(sender, args) {
                var editor = $find("<%=RadEditor1.ClientID%>");
                currContent = editor.get_html(true);
                editor.set_html("");
            }
            function EndRequestHandler(sender, args) {
                var editor = $find("<%=RadEditor1.ClientID%>");
    
                editor.set_html(currContent);
                currContent = null;
            }
            Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);