How can modify the module list template to support only one

Posted by Community Admin on 05-Aug-2018 11:22

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

All Replies

Posted by Community Admin on 25-Mar-2013 00:00

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,

Posted by Community Admin on 25-Mar-2013 00:00

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?

This thread is closed