ContentAreaCssFile... multiple files?

3 posts, 0 answers
  1. Marja
    Marja avatar
    70 posts
    Member since:
    Nov 2013

    Posted 04 Feb 2014 Link to this post

    Hi,

    We're using the RadEditor in the administration area of our custom CMS, and we'ld like to be able to specify multiple files for the ContentAreaCssFile property:
    1. the main website skin CSS file of the target website, so the (text) styling in the editor looks familiar to the person editing the content
    2. a temporary CSS file just for the editor itself, eg. to specify a temporary visible (dashed) border for a DIV element which is inserted using a custom dialog

    How do we accomplish this?

    Best regards, Marja


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Feb 2014 in reply to Marja Link to this post

    Hi Marja,

    Please have a look into the sample code snippet for multiple ContentArea Class for one RadEditor.

    ASPX:
    <telerik:RadEditor ID="RadEditor1" runat="server">
    </telerik:RadEditor>

    CSS:
    <style type="text/css">
        .Contentarea1
        {
            color: White !important;
            background-color: Red !important;
        }
        .Contentarea2
        {
            color: Black !important;
            background-color: Yellow !important;
        }
    </style>

    JavaScript:
    <script type="text/javascript">
        function ChangeClass() {
            var editor = $find("<%=RadEditor1.ClientID %>");
            if ( //your code for condtion)
                editor.get_contentArea().className = "ContentArea1";
            else
                editor.get_contentArea().className = "ContentArea2";
        }
    </script>

    Thanks,
    Shinu.
  3. Ianko
    Admin
    Ianko avatar
    1940 posts

    Posted 06 Feb 2014 Link to this post

    Hello Marja,

    You can use also the ContentAreaCssFile property in a custom Server-side logic, which implements the logic to set the desired CSS file of the content area.

    You can examine this live example for more information on this matter.

    Regards,
    Ianko
    Telerik
    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top