Take number of items in Media Folder within folders
Hi everyone,
i have some issues with a media folder where i need to display only 10 items within media folder.
With a media Picker the user can choose a media folder where there are sub folders.
if(CurrentModel.HasProperty("rMFolder") && CurrentModel.GetProperty("rMFolder").Value != String.Empty){ int MFolder = Convert.ToInt32(CurrentModel.GetProperty("rMFolder").Value); var DocumentLib = new Media(MFolder);
if (DocumentLib.ChildCount > 0) { var count =0 ; IEnumerable<Media> fd = DocumentLib.GetChildMedia().OrderByDescending(x => x.CreateDateTime).Where(x => x.ContentType.Alias == "Folder"); foreach (var docFolder in fd) {
if (docFolder.ChildCount > 0) {
IEnumerable<Media> f = docFolder.GetChildMedia().OrderByDescending(x => x.CreateDateTime).Where(y => y.ContentType.Alias == "File"); foreach(var t in f.Take(10)){ count ++; @count @:- @t.Text in @t.Parent.Text<br/> } } } } }
But here i cant get it to display only the 10 latest items within media folders.
Take number of items in Media Folder within folders
Hi everyone,
i have some issues with a media folder where i need to display only 10 items within media folder.
With a media Picker the user can choose a media folder where there are sub folders.
But here i cant get it to display only the 10 latest items within media folders.
Any idea why ?
Looks like i was in the wrong direction. This is how i should have done this
is working on a reply...