How to access image library
Hi,
I've this sample to access NewsItem and a related Image to every NewsItem.
What I need is to just access the Image Library "Thumbnails".
As I'm a novice with LinQ I can't make it work.
this.RadRotator1.DataSource = App.WorkWith()
.NewsItems()
.Where(n => n.Status == ContentLifecycleStatus.Live)
.Get()
.Take(this.NewsLimit)
.ToList()
.Join(App.WorkWith()
.Images()
.Get()
.Where(i => i.Parent.Title == "Thumbnails" && i.Status == ContentLifecycleStatus.Live),
item => item.Title.Value,
image => image.Title.Value,
(item, image) => new NewsItem = item, NewsImage = image );
Can somebody help me please to clean the NewsItem from but keep the typ NewsImage as it is?
Thanks
Andre
Hi Andre,
You can get a specific library by its name this way:
var album = App.WorkWith().Albums().Where(p => p.Title == "MYALBUMNAME").Get().SingleOrDefault();
Hi Victor,
I get an error when I try to use tihs as DataSource for the RadTree:
Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
I'm a novice with LinQ so how can I cast it to the needed datatype?
Thanks
Andre
Hello Andre,
You can create a list of images from a particular album ( or you can get the album names, depending on what you want to achieve ) and bind them in the TreeView. Please consult our API, which contains examples of how to use the images API:
www.sitefinity.com/.../querying-images
You can also check the RadTree demos on our website, in order to understand how it works:
demos.telerik.com/.../defaultcs.aspx
Regards,
Victor Velev
the Telerik team