More in this section

Forums / Developing with Sitefinity / how tt Get ImageURL from custom field in Sitefinity7.0

how tt Get ImageURL from custom field in Sitefinity7.0

2 posts, 0 answered
  1. Sunny
    Sunny avatar
    9 posts
    22 Nov 2011
    15 Jul 2014
    Link to this post

    I have added a custom field by the name "FAQImage" in a FAQlist.

    How do i get the URL value from my custom field in FAQ list 


  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    19 Apr 2017
    18 Jul 2014
    Link to this post
    Hello Sunny,

    There are several ways to obtain an image Url. However, you should first get the Image object. You can achieve this by using the extension methods GetValue or GetValue<T> from the Telerik.Sitefinity.Model namespace, for instance:
    var img = dataItem.GetValue<Telerik.Sitefinity.Libraries.Model.Image>("MyImageField");
    Then using the Image you could get its Url:

    Default location Url

    or Resolve its Url and get full UrlPath:
    UrlPath.ResolveUrl(DataResolver.Resolve(img, "URL", null), true);

    Nikola Zagorchev
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered