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

Forums / Developing with Sitefinity / Image Gallery in custom generic content module

Image Gallery in custom generic content module

3 posts, 1 answered
  1. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    14 Jan 2010
    Link to this post
    Hi All,

    I have developed a custum generic content module for a customer of ours. Almost everything works like a charm but for the display of a image gallery on the item detail page. The correct gallery is displayed but in "list and page" mode although I specified "lightbox" mode.

    <%@ Control Language="C#" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfCtrl" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Web.UI.SpamProtection" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <%@ Register TagPrefix="sfLib" Namespace="Telerik.Libraries.WebControls" Assembly="Telerik.Libraries" %> 
     
    <telerik:CssFileLink ID="CssFileLink1" EmbeddedFileName="Telerik.News.Resources.ControlTemplates.Frontend.newsCommonLayout.css" FileName="" Media="screen" runat="server" /> 
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery" /> 
     
    >>>>> I removed some irrelevant lines from the ascx file here <<<<<<  
     
        <div class="sf_personsGallery" id="sf_personsGallery"  runat="server">  
            <sfLib:ImageGallery id="ImageGallery" runat="server" GalleryTemplateMode="Lightbox" ItemsPerPage="3" ></sfLib:ImageGallery>    
        </div> 

    I think this is the case because the css class of the html ol tag in the resulting html page is set to sf_listAndPage. On another page which is used to display an ImageGallery control directly that css class is set to sf_photoListLightbox.

    Any pointer would be appriciated.

    David
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 Jan 2010
    Link to this post
    Hi David van Geel,

    The control is not supposed to work declaratively. You can add it to your template dinamically

    ImageGallery gallery = new ImageGallery();
    gallery.SelectedPresentationMode.ID = "Lightbox";
    gallery.GalleryTemplateMode = ImageGallery.GalleryViewMode.Lightbox;
    gallery.BehaviorMode = Telerik.Cms.Engine.WebControls.ContentView.BehaviorModes.Master;
    gallery.ItemListTemplateName = "Telerik.Libraries.Resources.ControlTemplates.Frontend.GalleryLightboxList.ascx";
    Controls.Add(gallery);
     

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  3. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    14 Jan 2010
    Link to this post
    Hi Ivan,

    Thanks for the quick reply. It works great.

    David
Register for webinar
3 posts, 1 answered