how tt Get ImageURL from custom field in Sitefinity7.0

Posted by Community Admin on 04-Aug-2018 10:56

how tt Get ImageURL from custom field in Sitefinity7.0

All Replies

Posted by Community Admin on 15-Jul-2014 00:00

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 

 

Posted by Community Admin on 18-Jul-2014 00:00

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
 

This thread is closed