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

Forums / Developing with Sitefinity / how to get records and images and display on page which are saved by module bulider

how to get records and images and display on page which are saved by module bulider

3 posts, 0 answered
  1. Manoj
    Manoj avatar
    1 posts
    Registered:
    02 Aug 2012
    14 Feb 2012
    Link to this post
    HI.
    i have one case  where i created one module with  siteinfinity  4.4 and save some records and stroe images .
    i am able  display the  records using following code
    But how i will  display  image . or how i get  image url
    <%@ 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)
            {
                DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
                Type profileManagerType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.ProfileManager.ProfileManager");
     
                // Fetch a collection of "live" and "visible" Person items.
                var myCollection = dynamicModuleManager.GetDataItems(profileManagerType).Where(i => i.Status == ContentLifecycleStatus.Live && i.Visible == true);
     
                // Binds the collection of Person items to the RadGrid
                Grid.DataSource = myCollection;
                Grid.DataBind();
            }
        }
    }
     
    Thanks
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    17 Feb 2012
    Link to this post
    Hello,

     Get the module item or items and then call GetValue() you will need to add
    using Telerik.Sitefinity.Model;

    var myFilteredCollection = dynamicModuleManager.GetDataItem(cupType, new Guid( ... guid here)).GetValue("image");
     
    //the image field is called "image" GetValue() gets the value of a field by its name

    Regards,
    Stanislav Velikov
    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
  3. Irfan
    Irfan avatar
    1 posts
    Registered:
    28 Aug 2012
    06 Sep 2012
    Link to this post
    how to get images from image gallery & bind it with Grid View?
3 posts, 0 answered