Lots of extra HTML output for RadEditor

4 posts, 0 answers
  1. msigman
    msigman avatar
    141 posts
    Member since:
    Apr 2008

    Posted 18 Oct 2010 Link to this post

    I have a RadEditor with very basic functionality.  Nothing in the modules section, using external Toolbar file, and external CSS file.

    However, this is generating a tremendous amount of code to the page for things like Image Manager, Document manager, etc, which I am not using.  Also it's adding a lot of extra code for localization: $create(Telerik.Web.UI.RadEditor, {"_localization":{"addcustomcolor":"Add Custom Color...","addcustomhexcolor":"Add Hex Color...","

    Except that I'm not using Add custom color, hex color, or anything other than bold, italic, underline.

    How can I trim this way down?
  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 21 Oct 2010 Link to this post

    Hello Matthew,

    You can remove all the dialog definitions from the dialog opener control after they are populated on the server. Unfortunately, this happens pretty late in the page lifecycle (PreRender event). Here is some sample code that might help:

    <telerik:RadEditor ID="RadEditor1" ToolsFile="~/basictools.xml" runat="server">
    </telerik:RadEditor>
     
    <script type="text/C#" runat="server">
    protected override void OnPreRenderComplete(EventArgs e)
    {
        RadEditor1.DialogOpener.DialogDefinitions.Clear();
        base.OnPreRenderComplete(e);
    }
    </script>

    This will clear the dialog definitions and will reduce the size of the page on the client.

    The localization strings come from the server and they could not be changed.

    Sincerely yours,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. msigman
    msigman avatar
    141 posts
    Member since:
    Apr 2008

    Posted 28 Oct 2010 Link to this post

    Thanks for your reply.  Unfortunately, the RadEditor in question is located in a Master Page which doesn't have the OnPreRenderComplete event available.  I tried it in OnPreRender and it didn't work.  Any ideas?
  5. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 01 Nov 2010 Link to this post

    Hi Matthew,

    The code below will work without problems if the editor is placed in the content page:

     protected override void OnPreRenderComplete(EventArgs e)
    {
    RadEditor1.DialogOpener.DialogDefinitions.Clear();
    base.OnPreRenderComplete(e);


    If the editor is placed in the masterpage then you can subclass the RadEditor control (RadEditor editor = new RadEditor();), override its Control PreRender event, call the base and clear the
    DialogDefinitions
     collection using

     RadEditor1.DialogOpener.DialogDefinitions.Clear();

    This is the only possible approach that I could suggests.

    Kind regards,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top