November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Just a quick note, and not an answer to your question:
If you are creating an image gallery, you should take look at the existing free module at Epicode. Have a look here:
https://www.coderesort.com/p/epicode/wiki/PictureGallery
--
Lars Øyvind Bodahl
www.epinova.no
The module includes code to implement pagination and it uses a repeater to display the images.
It uses the following code to retrieve all images in a folder:
UnifiedDirectory dir = System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetDirectory(filePath) as UnifiedDirectory;
unsortedFiles = dir.GetFiles(); ArrayList arrayListSorted = new ArrayList(unsortedFiles); //creating arraylist with the pic, and do a sorting with
allFiles = (UnifiedFile[])arrayListSorted.ToArray(typeof(UnifiedFile));
--
Lars Øyvind Bodahl
www.epinova.no
GetFiles() returns an array of UnifiedFile - LINQ is great when you want to retrieve a subset of that array. (if you're on the correct .NET version that is.. :-))
UnifiedFile[] files = directory.GetFiles();
// First X elements:
var tenFirst = files.Take(10);
// Skip X element before taking Y elements.
var nextTen = files.Skip(10).Take(10);
/magnus
Hi,
Thanks Magnus.
LINQ looks perfect, however when I use Take(10) on a collection of 14 I get a null collection back, have you had any issues with the unfiedCollection like this?
Regards,
Ian
Hi,
Using the GetFiles() method of the unified file system I want to create an image gallery. As part of the gallery I need to implement pagination. Has anyone done this or knows of teh most effecient way to retrieve a subset of collection returned from getFiles()?
Thanks in advance