protected void Page_Load(object sender, EventArgs e)
        {
            string path = this.ViewName.ControlPath();

            ContentQuery contentQuery = new ContentQuery
            {
                NumRecords               = this.NumRecords,
                UserID                   = this.UserID,
                ContentTypeID            = (int)SueetieContentType.MediaImage,
                GroupID                  = this.GroupID,
                ApplicationID            = this.ApplicationID,
                IsRestricted             = this.IsRestricted,
                TruncateText             = false,
                SueetieContentViewTypeID = (int)SueetieContentViewType.RecentPhotos,
                CacheMinutes             = this.CacheMinutes
            };

            List <SueetieMediaObject> recentPhotos = SueetieMedia.GetSueetieMediaObjectList(contentQuery);

            foreach (SueetieMediaObject photo in recentPhotos)
            {
                Sueetie.Controls.RecentPhotoView control = (Sueetie.Controls.RecentPhotoView)LoadControl(path);
                control.RecentPhoto = photo;
                phRecentPhotos.Controls.Add(control);
            }
        }
        private void BindData()
        {
            //Get the data associated with the album and display
            if (this.GalleryObjectsDataSource == null)
            {
                // Sueetie Modified - Retrieve Recent Photos
                if (DataHelper.GetIntFromQueryString("aid", 1) == -1)
                {
                    List <SueetieMediaObject> sueetieMediaObjects = SueetieMedia.GetSueetieMediaObjectList(this.GalleryPage.CurrentSueetieGalleryID, true);

                    sueetieMediaObjects.Sort(delegate(SueetieMediaObject x, SueetieMediaObject y) { return(DateTime.Compare(y.DateAdded, x.DateAdded)); });

                    int _photoCount = SueetieConfiguration.Get().Media.RecentPhotoCount;
                    if (_photoCount > sueetieMediaObjects.Count)
                    {
                        _photoCount = sueetieMediaObjects.Count;
                    }
                    IGalleryObjectCollection _galleryObjects = new GalleryObjectCollection();
                    for (int i = 0; i < _photoCount; i++)
                    {
                        IGalleryObject _galleryObject = Factory.LoadMediaObjectInstance(sueetieMediaObjects[i].MediaObjectID);
                        _galleryObjects.Add(_galleryObject);
                    }

                    _galleryObjects.Sort();
                    DisplayThumbnails(_galleryObjects, true);
                }
                else
                {
                    DisplayThumbnails(this.GalleryPage.GetAlbum().GetChildGalleryObjects(true, this.GalleryPage.IsAnonymousUser), true);
                }
            }
            else
            {
                DisplayThumbnails(this.GalleryObjectsDataSource, false);
            }
        }