1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Problem with ImageGallery in version 3.6

Problem with ImageGallery in version 3.6

12 posts, 0 answered
  1. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    08 May 2009
    Link to this post

     

    Hello Telerik team

    In a website, developed in version 5 of Sitefinity, I extended the image gallery with the following code (for compact code I didn't send the logic for SetSingleItemMetaData and SetListMetadata):

     

    using

     

    System.Web;
    using System.Web.UI;

    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.ComponentModel;
    using Telerik.Cms.Engine;

     

    namespace

     

    Telerik.Libraries.WebControls
    {

    /// <summary>
    /// Summary description for ImageGalleryExtender
    /// </summary>
    public class ImageGalleryExtender: ImageGallery
    {

     

     

    public ImageGalleryExtender()
    {
    //
    // TODO: Add constructor logic here
    //
    }

     

     

    private bool _showOnlyFirstImage = false;
    private string _selectedLibraries = "";

    [
    Category("Behavior")]
    public bool ShowOnlyFirstImage
    {
    get
    {
    return _showOnlyFirstImage;
    }

     

     

    set
    {
    _showOnlyFirstImage =
    value;
    }
    }

     

     

    protected override void CreateChildControls()
    {
    base.ListViewTemplatePath = "~/ControlTemplates/Libraries/GalleryListView.ascx";
    base.ListViewItemTemplatePath = "~/ControlTemplates/Libraries/GalleryListViewItem.ascx";

     

     

    base.CreateChildControls();
    }

     

     

    protected override void SetSingleItemMetadata(Control itemContainer, IContent contentItem)

    //All the images of the selected libraries will be shown
    base.SetListMetadata(itemContainer, contentItem);
    }

     

     

    protected override void SetSingleItemContent(IContent contentItem)

     

    {

    base.SetSingleItemContent(contentItem);
    }

     

     

    protected override void SetListMetadata(Control itemContainer, IContent contentItem)

     

    {

    }

     

    }

    }


    In version 5 everything worked fine but after upgrade I am getting the error:

    Invalid resource name (Telerik.Libraries.Resources.ControlTemplates.Frontend.GalleryListView.ascx) for assembly (App_Code.w8obv3uv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) or empty template.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Invalid resource name (Telerik.Libraries.Resources.ControlTemplates.Frontend.GalleryListView.ascx) for assembly (App_Code.w8obv3uv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) or empty template.

    Source Error:

    Line 42:             base.ListViewItemTemplatePath = "~/ControlTemplates/Libraries/GalleryListViewItem.ascx";
    Line 43: 
    Line 44: base.CreateChildControls();Line 45:         }
    Line 46: 

    Source File: c:\Program Files\telerik\Sitefinity3.6\WebSites\CMS_ElbertGubbels\App_Code\ImageGalleryExtender.cs    Line: 44


    Have you an idea what the problem could be?

    Kind regards
    Luc

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    08 May 2009
    Link to this post
    Hi Luc Baeten,

    In your code you are calling the base class and it is looking for the embedded template

    protected override void CreateChildControls() 
    base.ListViewTemplatePath = "~/ControlTemplates/Libraries/GalleryListView.ascx"
    base.ListViewItemTemplatePath = "~/ControlTemplates/Libraries/GalleryListViewItem.ascx";  

    To fix the problem call this.ListViewTemplatePath and this.ListViewItemTemplatePath.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    08 May 2009
    Link to this post
    Hello Ivan

    I based the implementation on thread http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bttbdb.aspx

    In version 3.5 of Sitefinity it worked perfectly.
    I tried your suggestion  but I get still the same error.

    Regards
    Luc
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 May 2009
    Link to this post
    Hello Luc Baeten,

    Could you please add the following methods to your control:
       public override Type LocalizationAssemblyInfo 
        { 
            get 
            { 
                return typeof(ImageGallery); 
            } 
            set 
            { 
                base.LocalizationAssemblyInfo = value; 
            } 
        } 
        public override Type AssemblyInfo 
        { 
            get 
            { 
                return typeof(ImageGallery); 
            } 
            set 
            { 
                base.AssemblyInfo = value; 
            } 
        } 

    This way you will be able to run your custom control with the control templates of the ImageGallery control.

    You can also try to override:
    • ItemListTemplatePath
    • SingleItemTemplatePath
    properties, rather to initialize them on CreateChildControls.
    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    11 May 2009
    Link to this post
    Hello Georgi

    Thank you for the code. This solved the problem.
    But is it possible to give me a short explanation to the code, so that I know what I am doing? Thank you in advance.

    Kind regards
    Luc
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 May 2009
    Link to this post
    Hello Luc Baeten,

    Here is more description about these properties.

    • public virtual Type AssemblyInfo { get; set; }
      Gets or sets the assembly info on the assembly from which the embedded resources should be loaded. The property is of type Type and in order to set it, it is enough to set it to any Type which is located in the assembly with the embedded templates.
    • public virtual Type LocalizationAssemblyInfo { get; set; }
      Similar to the AssemblyInfo, LocalizationAssemblyInfo gets or sets info on the assembly in which localization messages are embedded. The property is of type Type and in order to set it, it is enough to set it to any Type which is located in the assembly with the embedded localization resources.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    11 May 2009
    Link to this post
    Hello Ivan

    Thank you very much for this info and for your support

    regards
    Luc
  8. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    11 May 2009
    Link to this post
    Hello Telerik Team

    There is still a problem:

    When I try to edit the ImageGalleryExtender in Sitefinity (Using Internet Explorer 7) it crashes, so I am not able to select the galleries that must be shown in the ImageGalleryExtender control.

    Should I change another thing?

    Regards
    Luc
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 May 2009
    Link to this post
    Hello Luc Baeten,

    We encountered similar issue a few days ago and our team has spent some time to investigate it although we cannot reproduce it locally.

    However here is what we suggest:

    Uncheck 'Enable third-party browser extensions' from Internet Options->Advanced->Browsing. This should fix the problem.

    The problem is related to the HTML rendered by PagingSetting server controls in the ImageGalleryControlDesigner template and there are two options to avoid it.
    You should make the designer template external (you can find all external templates and their mapping configuration in the download section in your Client.net account):

    1. In the ~/App_Data/Configuration/Telerik.Sitefinity.Configuration.ControlsConfig.xml add the following template mapping:

    <?xml version="1.0" encoding="utf-8"?>  
    <controlsConfig>  
      <viewMap>  
        <viewSettings hostType="Telerik.Libraries.WebControls.Design.ImageGalleryDesigner"   
        layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Libraries/ImageGalleryControlDesigner.ascx" />  
      </viewMap>  
    </controlsConfig>  

    layoutTemplatePath is the path where you store the external template. Generally you can add it to 
    ~/Sitefinity/Admin/ControlTemplates/Libraries/ImageGalleryControlDesigner.ascx

    Open the ~/Sitefinity/Admin/ControlTemplates/Libraries/ImageGalleryControlDesigner.ascx for edit and find the first instance of PagingSetting control:

    <sf:PresentationModeSettings ID="ModeSettings1" runat="server">  
        <DetailHeaderTemplate>  
        ...  
            <sf:PagingSetting id="pagingSetting" AllowPagingSetting="true" DefaultPageCount="10" AllowPaging="true" runat="server" />  
      


    Approach 1:
       Remove the instance of the control from the template

    Approach 2:
      Duplicated the PagingSetting control:

    <sf:PagingSetting id="pagingSetting" AllowPagingSetting="true" DefaultPageCount="10" AllowPaging="true" runat="server" />  
    <sf:PagingSetting id="pagingSetting1" AllowPagingSetting="true" DefaultPageCount="10" AllowPaging="true" runat="server" />  

    The templates and ControlsConfig file are attached for your convenience. Let us know if there is anything else that we can do for you.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    29 Jul 2009
    Link to this post
    Hello Ivan

    Because the assignment of ListViewTemplatePath  and ListViewItemTemplatePath in CreateChildControls

     

    protected override void CreateChildControls()

     

    {

     

    base.CreateChildControls();

     

     

    this.ListViewTemplatePath = "~/ControlTemplates/Libraries/GalleryListView.ascx";

     

     

    this.ListViewItemTemplatePath = "~/ControlTemplates/Libraries/GalleryListViewItem.ascx";

     

    }


    didn't work in v3.6 I moved back to v3.5 because I needed to publish the website on the web.
    But now I busy with upgrading the website to v3.6 again. However these templates are not used for presenting my ImageGalleryExtender but the default ones of Sitefinity are used.

    Have you an idea how to solve this?

    regards
    Luc Baeten
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 Jul 2009
    Link to this post
    Hi Luc Baeten,

    In 3.6 you can override ItemListTemplatePath. Then in CreateChildControls you can specify GalleyTemplateMode and control's behavior mode.

     
        protected override void CreateChildControls() 
        { 
            base.CreateChildControls(); 
            this.GalleryTemplateMode = GalleryViewMode.Lightbox; 
            this.BehaviorMode = BehaviorModes.Master; 
        } 


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  12. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    29 Jul 2009
    Link to this post
    Hello Ivan

    Instead of using ItemListTemplatePath I was using ListViewTemplatePath. With defining ItemListTemplatePath everything works again.

    Thanks you very much

    regards
    Luc Baeten
Register for webinar
12 posts, 0 answered