private void LoadGallery() { Gallery g = new Gallery(); g.Where.CategoryID.Value = CategoryID; if (g.Query.Load()) { HtmlTableRow row = new HtmlTableRow(); do { Image i = new Image(); i.ImageUrl = Path.Combine(Utils.GaleryImagePath, g.PhotoName); gallery.Controls.Add(i); } while (g.MoveNext()); } }
private void LoadCategoryPhoto() { string photoName = ""; int index = 1; int count = 0; bool photoFound = false; hlPrevLink.CommandArgument = ""; hlNextLink.CommandArgument = ""; Gallery g = new Gallery(); g.Where.CategoryID.Value = CategoryID; if (g.Query.Load()) { photoName = g.s_PhotoName; count = g.RowCount; do { if (this.PhotoName == g.s_PhotoName) { photoName = g.s_PhotoName; photoFound = true; continue; } if (photoFound) { hlNextLink.CommandArgument = g.s_PhotoName; break; } else { hlPrevLink.CommandArgument = g.s_PhotoName; index++; } } while (g.MoveNext()); } imageHolder.ImageUrl = Path.Combine(Utils.GaleryImagePath, photoName); ImageCount.Text = "Фотографія " + index + " з " + count; hdPhotoName.Value = photoName; if (index == 1) { hlPrevLink.Visible = false; } else { hlPrevLink.Visible = true; } if (index == g.RowCount) { hlNextLink.Visible = false; } else { hlNextLink.Visible = true; } }