How to Querying Images from Child Album(Child Folder)
Hi All,
I'm Created Folder structure in Image library. Means
ParentImagelibrary
image1, image2, image3.
I'm able to Get Images from Root Level Library.
ParentImagelibrary1
ChildImagelibrary1
Image1, Image2, Image3
How to Get Images from ChildImageLibrary. I write code some thing like but no luck :(
var allfolders = libraryManager.GetAllFolders(album);
foreach
(var fl
in
allfolders.ToList())
if
(fl.Title ==
"ChildImagelibrary1"
)
IFolder fl1 = fl;
var allimg =libraryManager.GetImages().Where(i => i.Id == fl1.Id);
Please Help me how to solve,
Thanks in Advance,
Hello Ajay,
You can use this code sample for getting the images from a single folder under a parent album:
protected
IEnumerable<Telerik.Sitefinity.Libraries.Model.Image> QueryImages(
string
parentAlbumTitle,
string
folderTitle)
LibrariesManager manager =
new
LibrariesManager();
var album = manager.GetAlbums()
.Where(f => f.Title == parentAlbumTitle)
.FirstOrDefault();
var folders = manager.GetAllFolders(album);
IEnumerable<Telerik.Sitefinity.Libraries.Model.Image> result =
new
List<Telerik.Sitefinity.Libraries.Model.Image>();
var folder = manager.GetAllFolders(album).Where(f => f.Title == folderTitle).FirstOrDefault();
if
(folder !=
null
)
result = manager.GetImages().Where(im => im.FolderId == folder.Id);
return
result;
protected
IEnumerable<Telerik.Sitefinity.Libraries.Model.Image> QueryImages(
string
parentAlbumTitle)
LibrariesManager manager =
new
LibrariesManager();
var album = manager.GetAlbums()
.Where(f => f.Title == parentAlbumTitle)
.FirstOrDefault();
var folders = manager.GetAllFolders(album);
IEnumerable<Telerik.Sitefinity.Libraries.Model.Image> result =
new
List<Telerik.Sitefinity.Libraries.Model.Image>();
foreach
(var item
in
folders)
var images = manager.GetImages().Where(im => im.FolderId == item.Id);
result = result.Concat(images);
return
result;
Hi Dear,
How to call this method in Controller.I created a IEnumerable<ImageModel> Image and
try to calling obj.Image=QueryImage("GalleryTitle");
but unable to find