More in this section
Forums / Module Builder / How can modify the module list template to support only one image

How can modify the module list template to support only one image

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Owidat
    Owidat avatar
    4 posts
    Registered:
    26 Jan 2011
    25 Mar 2013
    Link to this post
    Salam,

    I have created a new module and I'm having an Image Field where I'm allowing back-end users to publish multiple images for one item, and it is a very nice feature, and I'm trying to modify the list template "Using Thunder" or by editing it in the back end, and I want to display with the list only one image or the first image from the image list, but with the full item content I want to keep all images, what I have to change instead of this:

    <sf:ImageGalleryAssetsField runat="server" DataFieldName="Image" ImageGalleryMasterViewName="ImagesFrontendThumbnailsListLightBox" />

    Also is there any place that I can deeply understand how to modify the template?
    I know it a user control, but I want more information about Sitefinity "sf:....." controls and controls properties?

    Regards,
  2. Owidat
    Owidat avatar
    4 posts
    Registered:
    26 Jan 2011
    25 Mar 2013 in reply to Owidat
    Link to this post
    Ok I found one way to do it using code refernce "Integration example for <MyNewModule>", where I need to creat a custome user control, using Thunder:

    // ~/DisplayItems.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DisplayItems.ascx.cs" Inherits="SitefinityWebApp.DisplayItems" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
       
    <!-- ScriptManager or RadScriptManager is required by RadGrid, but this tag probably already exists on the Master Template -->
    <!-- <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> -->
    <telerik:radgrid id="Grid" runat="server" autogeneratecolumns="False">
        <mastertableview>
            <columns>
                <telerik:gridboundcolumn datafield="Title" headertext="Title">
            </telerik:gridboundcolumn></columns>
        </mastertableview>
    </telerik:radgrid>

    // ~/DisplayItems.ascx.cs
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using Telerik.Sitefinity.Model;
    using Telerik.Sitefinity.DynamicModules;
    using Telerik.Sitefinity.Data.Linq.Dynamic;
    using Telerik.Sitefinity.DynamicModules.Model;
    using Telerik.Sitefinity.Utilities.TypeConverters;
    using Telerik.Sitefinity.GenericContent.Model;
      
    namespace SitefinityWebApp
    {
        public partial class DisplayItems : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                // Fetch a collection of "live" and "visible" MyNewModule items.
                var myCollection = GetDataItems();
      
                // Binds the collection of Person items to the RadGrid
                Grid.DataSource = myCollection;
                Grid.DataBind();
            }
      
      
            // Gets a collection of "live" and "visible" MyNewModule items.
            public IQueryable<DynamicContent> GetDataItems()
            {
                DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
                Type MyNewModuleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.WNews.MyNewModule");
      
                // Fetch a collection of "live" and "visible" MyNewModule items.
                var myCollection = dynamicModuleManager.GetDataItems(MyNewModuleType)
                    .Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true);
          
                return myCollection;
            }
        }
    }

    is there any other way? by modifying list template?
2 posts, 0 answered