![]() |
Web Development »
Applications & Tools »
Applications
Intermediate
ASP.NET PhotoBookBy WoutLA simple photobook viewer. |
C#, Windows, .NET, ASP.NET, Visual Studio, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

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.
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:
[Photobooks]
[HolidayName]
[Photographer]
Thumbnails
[Photographer]
Thumbnails
[HolidayName]
[Photographer]
Thumbnails
[Photographer]
Thumbnails
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.
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.
| You must Sign In to use this message board. | ||||||||
|
||||||||
|
||||||||
|
||||||||
|
||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Oct 2004 Editor: Smitha Vijayan |
Copyright 2004 by WoutL Everything else Copyright © CodeProject, 1999-2009 Web20 | Advertise on the Code Project |