Trouble getting images from Sitefinity galleries
I am having an issue with a RadRotator user control that I created. Basically whenever I run the following bit of code, all images in the gallery appear twice. I have the same issue with a similar query for the news items.
var images = App.WorkWith().Albums().Where(a => a.Title == title).Get().FirstOrDefault().Images;
foreach (Telerik.Sitefinity.Libraries.Model.Image i in images)
Hashtable ht = new Hashtable();
ht.Add(
"Url", i.MediaUrl);
ht.Add(
"Title", i.Title.ToString());
results.Add(ht);
Hello Wesley,
You need to get only the Live status of the images - you can specify this in your code like this:
var images = App.WorkWith().Albums().Where(a => a.Title == title).Get().FirstOrDefault().Images.Where(i => i.Status == ContentLifecycleStatus.Live);
Thanks, I knew it had to be a simple answer!