More in this section

Forums / Developing with Sitefinity / Custom Content Block w/ Shared Content

Custom Content Block w/ Shared Content

9 posts, 0 answered
  1. Stephen Long
    Stephen Long avatar
    20 posts
    Registered:
    29 Sep 2009
    20 Jul 2011
    Link to this post
    I have created a custom ContentBlock which inherits from the standard ContentBlock.  This custom control works perfectly except for one thing:

    I can select Shared content to display (or create) within the CustomContentBlock, but if I update the shared content in the Sitefinity Backend, the page displaying/using my CustomContentBlock is  not updated.  Further, Sitefinity tells me that ZERO pages are using the shared content.  Is there anything special that must be done to get this to work properly, or is there a bug in Sitefinity itself?

    For reference, my simple code is below:

    namespace SitefinityWebApp
    {
        public class StyledContentBlock : ContentBlock
        {
            private string _minHeight = "100%";
     
            public override string LayoutTemplatePath
            {
                get
                {
                    var path = "~/SFTemplate/SitefinityWebApp.Resources.ControlTemplates.ContentBlock.ascx";
                    return path;
                }
                set
                {
                    base.LayoutTemplatePath = value;
                }
            }
     
            protected override string LayoutTemplateName
            {
                get
                {
                    return null;
                }
            }
     
            [Browsable(true)]
            [Category("Appearance")]
            [Description("The Title text of the Control")]
            public string Title
            {
                get
                {
                    return _title;
                }
                set
                {
                    _title = value;
                }
            }
     
            [Browsable(true)]
            [Category("Appearance")]
            [Description("The minimum height of the Control")]
            public string ControlHeight
            {
                get
                {
                    int result;
                    if (!int.TryParse(_minHeight, out result))
                    {
                        _minHeight = _minHeight.Replace("%", "").Replace("px", "");
                    }
     
                    return _minHeight;
                }
                set
                {
                    _minHeight = value;
                }
            }
     
            [Browsable(false)]
            public Literal TitleText
            {
                get { return this.Container.GetControl<Literal>("title", true); }
            }
     
            protected override void Render(HtmlTextWriter writer)
            {
                TitleText.Text = _title;
                HtmlGenericControl divHolder = this.Container.GetControl<HtmlGenericControl>("divHolder", true);
     
                if (!_minHeight.Contains("%"))
                {
                    divHolder.Style.Add("min-height", string.Format("{0}px", (int.Parse(_minHeight)).ToString()));
                }
     
                if (string.IsNullOrWhiteSpace(_title))
                {
                    TitleText.Parent.Visible = false;
                }
     
                base.Render(writer);
            }
     
            protected override void InitializeControls(GenericContainer controlContainer)
            {
                base.InitializeControls(controlContainer);
            }
     
            private string _title = string.Empty;
            private string layoutTemplateName = "SitefinityWebApp.Resources.ControlTemplates.ContentBlock.ascx";
        }
    }

    And here is my simple control template:

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit"
        Assembly="Telerik.Sitefinity" %>
    <div id="divHolder" class="styledcontent" runat="server">
        <sf:ContentBrowseAndEditToolbar ID="browseAndEditToolbar" runat="server" Mode="Edit,Delete" />
        <div id="divTitle" runat="server" class="title">
            <asp:Literal ID="title" runat="server" />
        </div>
        <div class="content">
            <asp:Literal ID="contentHtml" runat="server" />
        </div>
    </div>

    Thanks,
    Stephen
  2. Stephen Long
    Stephen Long avatar
    20 posts
    Registered:
    29 Sep 2009
    25 Jul 2011
    Link to this post
    Any help on this would be greatly appreciated.
  3. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    26 Jul 2011
    Link to this post
    Hi Stephen Long,
     
    Actually this behavior is by design as each new type added will not be reflected properly in the shared content statistics (since they are generated by type). I have logged a feature request for you, demanding the implementation of such feature for the upcoming releases, please find the item in PITS on  this Public URL where you can track its progress and vote for it.

    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Stephen Long
    Stephen Long avatar
    20 posts
    Registered:
    29 Sep 2009
    26 Jul 2011
    Link to this post
    Boyan, thanks for the reply.  That sounds like a bizarre design choice, considering it deviates from Sitefinity 3.7.  So, by design currently, no custom controls that inherit from out of the box controls that support shared content will work properly with shared content?
  5. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    26 Jul 2011
    Link to this post
    Hi Stephen Long,

    I'm afraid this is the current situation, please accept our apologies for that if it's causing any inconveniences. Indeed the use case scenario you have outlined in this forum post is a completely valid one, I'll start an internal discussion on this functionality. If there's anything else you need to know, please don't hesitate to ask.

    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Stephen Long
    Stephen Long avatar
    20 posts
    Registered:
    29 Sep 2009
    26 Jul 2011
    Link to this post
    Thanks Boyan!

    Is there any time-frame for this fix?

    I'm a bit concerned that Sitefinity4 is already at SP3, but is lacking a lot of basic functionality.  Little things, like this basic feature, become road-blocks for customizations my company implements and/or implemented with Sitefinity 3.7 without any problems.  Even though we have purchased ~ 4 licenses for Sitefinity4, part of me is leaning toward falling back to using Sitefinity 3.7 since it is more feature complete.
  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    01 Aug 2011
    Link to this post
    Hi Stephen,

    The issue is logged. Most probably we won't be able to provide the fix for the 4.2 release.
    All these little things will start to appear in the system with every release, after the 4.2 version. All the little widgets and missing functionality here and there. Apart from the performance optimization, the migration story and missing features from 3.7, our entire Q will be focused on little things that polish the product. 

    Best wishes,
    Georgi
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Stephen Long
    Stephen Long avatar
    20 posts
    Registered:
    29 Sep 2009
    01 Aug 2011
    Link to this post
    Thank you Georgi.

    My company has 4+ Sitefinity 4.x licenses, but the issues that keep creeping up are becoming road blocks for us.  Is there any way to receive/use Sitefinity 3.7 licenses in the interim until such a time that Sitefinity 4.x has feature parity with 3.7?  I have contacted your sales department regarding this, but have received no response from them.

    Thanks,
    Stephen

    EDIT - Please disregard.  I received a reply and am working this out with Telerik support.
  9. Maria
    Maria avatar
    1 posts
    Registered:
    24 Aug 2012
9 posts, 0 answered