1

I'm using Telerik Sitefinity 5.1. I've build a module that has 3 fields {title, url, image} title and url -> string field image -> 'image selector'

.cs

protected void Page_Load(object sender, EventArgs e)
    {       
        var myCollection = GetDataItems();

        RadRotator1.DataSource = myCollection;
        RadRotator1.DataBind();
    }

    public IQueryable<DynamicContent> GetDataItems()
    {
        DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
        Type brandLogosType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.BrandLogos.BrandLogos");         
        var myCollection = dynamicModuleManager.GetDataItems(brandLogosType).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true);

        return myCollection;
    }

asp.x

<telerik:RadRotator ID="RadRotator1" runat="server" RotatorType="AutomaticAdvance"
BorderWidth="4px" Width="100px" Height="100px" ScrollDirection="Down">
<ItemTemplate>
    <asp:Image runat="server" ID="image1" />
    <%-- <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("title") %>'></asp:Label>--%>
    <asp:Image ID="img1" runat="server" ImageUrl='<%# Eval("UrlWithExtension") %>' />
</ItemTemplate>

Getting title and url field with Text='<%# Eval("title") %>' But don't know how to get image like this. Can somebody show me?

Thanks in advance.

ozkank
  • 1,464
  • 7
  • 32
  • 52

2 Answers2

2

the Image field stores a reference to a Sitefinity image using a ContentLink, this ContentLink is what is actually stored in the property.

You can expand the content link to get the image with a helper method, as described here: http://www.sitefinity.com/blogs/joshmorales/posts/josh-morales-blog/2012/01/19/retrieving_data_from_dynamic_modules_using_the_module_builder_api

I hope this is helpful!

SelAromDotNet
  • 4,715
  • 5
  • 37
  • 59
0

Hello i had solved that issue via creating a function in code behind file at our custom control, and called that method inside control.ascx file where i have added a repeater & asp.net image control field to show the image here is the solution with example in my site

Get Images in custom control from Custom module image asset field

Ashfaque Ali Solangi
  • 1,883
  • 3
  • 22
  • 34