+1-888-365-2779
Try Now
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
    Registered:
    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
    Registered:
    24 Nov 2016
    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:
    img.Url;

    Default location Url
    SystemManager.GetContentLocationService().GetItemDefaultLocation(img).ItemAbsoluteUrl;

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



    Regards,
    Nikola Zagorchev
    Telerik
     
    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