|
|||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionThis ASP.NET application shows thumbnails and photos. It does nothing more and nothing less. BackgroundEvery 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 codeThe 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. BookTreeThe [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 PhotosThe second control is called 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 controlsThe controls are in the same project as the webpage. The assembly still needs an extra registration in the webpage however. This to register the <%@ 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. ConclusionPhotobook 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.
|
||||||||||||||||||||||||||||||||||||||||