More in this section

Forums / General Discussions / how to applying custom styles to format block in sitefinity 4.o ?

how to applying custom styles to format block in sitefinity 4.o ?

2 posts, 0 answered
  1. Björn
    Björn avatar
    11 posts
    Registered:
    29 Nov 2007
    06 Dec 2010
    Link to this post
    hi,

    how to  applying custom styles to format block in sitefinity 4.o ?

    i am using sitefinity 4.0 rc

    in sitefinity 3.7 we simply change in EditorToolsFile.xml file. but how can we do in sitefinity 4.o ?

    i will saw the following link
    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/add-custom-css-classes-to-radeditor-for-content-block.aspx

    i did according to above link instruction. but i t was not working.below is the my code .please correct me where was i wrong .

    class ContentBlockCustom
    using System.Web;
    using Telerik.Sitefinity.Modules.GenericContent.Web.UI;
    using Telerik.Sitefinity.Web.UI.ControlDesign;
     
    /// <summary>
    /// Summary description for ContentBlockCustom
    /// </summary>
     
    [ControlDesigner(typeof(ContentBlockDesignerCustom))]
    public class ContentBlockCustom:ContentBlock
    {
     
        protected override string LayoutTemplateName
        {
            get
            {
                return "~/controls/MyConetBlock/MyContentBlock.ascx";
            }
        }
     
     
    }

    DesignerDesigner
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Sitefinity.Modules.GenericContent.Web.UI;
     
    /// <summary>
    /// Summary description for ContentBlockDesignerCustom
    /// </summary>
    public class ContentBlockDesignerCustom : ContentBlockDesigner
    {
     
        protected override string LayoutTemplateName
        {
            get
            {
                return "~/controls/MyConetBlock/MyContentBlock.ascx";
            }
        }
     
    }

    and my controller
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyContentBlock.ascx.cs" Inherits="controls_MyConetBlock_MyContentBlock" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
     
      
    <asp:Literal ID="contentHtml" runat="server"></asp:Literal>
     
     
    <sf:ResourceLinks id="resourcesLinks" runat="server">
      
        <sf:ResourceFile Name="~/App_Data/Sitefinity/WebsiteTemplates/YourTemplate/App_Themes/YourTheme/Black Yellow/EditorStyleCss/editor_styles.css" />
      
    </sf:ResourceLinks>
      
       
      
    <sf:FormManager ID="formManager" runat="server" />
      
    <div style="width: 660px; overflow: hidden;">
      
        <sf:HtmlField
      
            ID="htmlEditor"
      
            runat="server"
      
            Width="99%"
      
            Height="370px"
      
            EditorContentFilters="DefaultFilters"
      
            EditorStripFormattingOptions="MSWord,Css,Font,Span,ConvertWordLists"
      
            DisplayMode="Write">
      
        </sf:HtmlField>
      
    </div>
      
    <script type="text/javascript">
     
        $("body").addClass("sfContentBlockDesigner");
      
    </script>

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Dec 2010
    Link to this post
    Hello Björn,

    You can map the template of the GontentBlock designer from Sitefinity's configuration ( take a look at attached screenshot) and then set the property of theHtmlField control.

    Kind regards,
    Ivan Dimitrov
    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
2 posts, 0 answered