Click here to Skip to main content
12,701,087 members (29,950 online)
Click here to Skip to main content
Add your own
alternative version


62 bookmarked

ASP.NET PhotoBook

, 17 Oct 2004
Rate this:
Please Sign up or sign in to vote.
A simple photobook viewer.

Sample Image - photobook.jpg


This ASP.NET application shows thumbnails and photos. It does nothing more and nothing less.


Every year we go on holiday with a couple of friends. After each holiday, we want to share our digital photos. We tried mailing a CD around, but we wanted a better solution. So I volunteered to make a website where everyone can download the photos they want.

I wanted the application to be as simple as possible. Just a webpage with some photos. And no database. I ended up with one webpage with two custom controls.

Using the code

The webpage itself is very simple. It is just plain HTML (with some ASP.NET of course). All formatting of the page is done in CSS.

Also, the code behind the page is simple:

public class _default : System.Web.UI.Page
    protected System.Web.UI.WebControls.Panel pnlPhotos;
    protected Photobook.Photos Photos1;
    protected BookTree BookTree1;
    private void Page_Load(object sender, System.EventArgs e)
        Photos1.Holiday = Request.QueryString["Holiday"];
        Photos1.By = Request.QueryString["By"]; }

In my humble opinion, just the two custom controls need some explanation.


The BookTree control writes a simple tree to the webpage using <UL> and <LI> elements. The tree is the directory structure under the Photobooks directory. This last directory is a directory under the webpage. The structure is like this:


The photos of a particular photographer are placed in the [Photographer] directories. In the Thumbnails directory are thumbnails of the photos with the same name as the photo in the [Photographer] directory.

In the webpage, the [Photographer] directories will be displayed as links. The HREF they point to is the same page (default.aspx in my case), but with two extra options: Holiday and by. There values are [HolidayName] and [Photographer].


The second control is called photos. This control just shows the images of the photos (JPGs) in a directory. If thumbnails are available in the Thumbnails they will be displayed instead of the photos themselves.

If a user clicks on one of the thumbnails, the corresponding picture will be displayed in its original size, so the user can save it to his own hard disk.

Using the controls

The controls are in the same project as the webpage. The assembly still needs an extra registration in the webpage however. This to register the TagPrefix:

<%@ Register TagPrefix="cc1" Namespace="Photobook" Assembly="Photobook" %>

Putting the controls onto the webpage goes like this:

<cc1:booktree id="BookTree1" runat="server" />
<cc1:photos id="Photos1" runat="server"  />

If you want to have the controls in the Toolbox, you can just register it. Visual Studio will put an extra reference to the DLL under References. You should delete this extra reference.


Photobook is a very simple photo book viewer with lots of limitations. The use of the application is very simple however, and that was my intention.

This is my first article on CodeProject. I don't know if I should explain the code some more, but I thought it was not necessary in this case.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralThank u very much Pin
dongxiang11-Jun-07 22:20
memberdongxiang11-Jun-07 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 17 Oct 2004
Article Copyright 2004 by WoutL
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid