protected void Page_Load(object sender, EventArgs e) { PhotoSet ps = getCompetitionPhotos(4); if (ps.Count > 0) { uiPhotoDataList.ItemTemplate = this.LoadTemplate("/Templates/GroupPhotos/CompetitionPhotoIcon.ascx"); uiPhotoDataList.DataSource = ps; uiPhotoDataList.DataBind(); Photo photo = ps[0]; if (!Url["k"].IsNull) { int photoK = Url["k"].ValueInt; Photo p1 = ps.First(p => p.K == photoK); if (p1 != null) { photo = p1; } else { // could still be an old competition photo in which case allow it. Photo p2 = new Photo(photoK); if (p2.ChildGroupPhotos().First(g => g.GroupK == Vars.CompetitionGroupK) != null) { photo = p2; } } } uiPhoto.Src = photo.WebPath; uiPhoto.Width = photo.WebWidth; uiPhoto.Height = photo.WebHeight; uiPhotoUrl.HRef = photo.Url(); uiCommentsDisplay.ParentObject = photo; if (photo.Thread != null) { uiCommentsDisplay.CurrentThread = photo.Thread; this.ThreadK.Value = photo.Thread.K.ToString(); } uiCommentsDisplay.DataBind(); currentPhotoK = photo.K; } duplicateGuid = Guid.NewGuid().ToString(); ContainerPage.Title = competitionTitle; if (Usr.Current == null) { uiCaptionText.Enabled = false; uiCaptionText.Text = "Please sign in to post a caption!"; uiPost.Disabled = true; } else uiCaptionText.Focus(); }