Wrox Programmer Forums
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 28th, 2008, 03:09 AM
Authorized User
Join Date: Sep 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sully7
Default Creating a Downloads Section


Let me start off by saying that I'm an 18 year old that is relatively new at ASP.NET, C#, and VB. I know HTML and CSS pretty strongly, but as I'm moving into college, I wanted to create a database style site for my companies, so that if I cannot make the updates, someone else easily can. I love the TBH design for this reason, because it allows me to do that, while adding many other awesome features (RSS, ecommerce, you all know the deal).

Right now I'm working on a project for one of my companies. It has hundreds of products and wants a mixture between an informational and e-commerce site. Now, I've followed TBH pretty much to the end, and have made some decent progress with understanding the code and the application, but I've hit somewhat of a roadblock. I'm trying to create a downloads section that is adaptable for each product (some products have one download, some have 0, some have 4 or 5). Now, I've created a simple Downloads section to the site, which is linked to the products section, but not as thoroughly as I would like.

The URL for the site is http://www.lawsonhemphill.com/lakotooldatabase/Web/

It is still in the developmental stage, and I'm actually working on a complete visual reconstruction now. If you want to log in, admin/admin works as username/password (like I said, its all developmental, and nothing thats on the site is valid or important, so I'm not afraid of anyone changing anything.) I'm also working on URL remapping, SEO, and sitemap/breadcrumb work, but I'm trying to take everything one step at a time, so Downloads comes first.

If you look under "Get Brochures & Technical Info", its very sloppy. (a little more than the rest of the site). The download links all work, but as you can see, some of the products don't fit all of the download slots. I linked the two sections using the "add/edit product" page, and an example can be seen here:


So (if you've survived reading this long), my question is, how would I go about making a "Downloads" section that is less rigid, and more like a "Manage Categories" section?

Old July 28th, 2008, 03:54 PM
Lee Dumond's Avatar
Wrox Author
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts

First of all, congratulations for taking on such a big project at your age. Hell, when I was 18, the PC hadn't even been invented yet! (That's okay, I was more into motorcycles back then anyway :))

If I may say, your problem is that you're "flattening" the structure far, far too much. It appears that you have your Downloads (texts and URLs) as fields of the Product table. This is not the way to go.

Instead, you need to have a separate Downloads table, and link it to the Products table with a foreign key.

Then, in your business layer, instead of having this:
Product.BrochureDownloadPDFText (string)
Product.BrochureDownloadPDFUrl (string)
Product.BrochureDownloadZIPText (string)
Product.BrochureDownloadZIPUrl (string)


You'd have this:
Product.Downloads ( List<Download> )

Each row in the Download table would have a field that links it to the Product row it belongs to. And the Download class would have it's own properties:



This way, each Product could have any number of downloads, and each download could be defined in any way you want. Of course, you'll need a separate Admin page to manage Downloads.

The book has a perfect example of this in the Articles section.

Look at the structure of this module. The articles object doesn't have properties like Comment1, Comment2, Comment3, etc. Instead, it has a property of List<Comment>, which is linked to the tbh_Comments table in the database.
Old July 29th, 2008, 03:25 AM
Authorized User
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts

As per Lee's post a separate table is certainly the way to go.

I wrote a "Resources" provider that integrates with the CMS to allow product documentation downloads (you can see it in action at: http://www.channelpumps.com/a27_Single_Disc_Pumps.aspx

This seems more or less what you want to achieve (although using the Products table instead - which will work in exactly same way).

My Resources table is structured as below:

ResourceID int
AddedDate datetime
AddedBy nvarchar(256)
ArticleID int
FileName nvarchar(256)
Description nvarchar(4000)
Title nvarchar(256)

You could probably work out all the necessarily CRUD methods by looking at how the comments work on the CMS (as the structure is very similar).

If you need to provide a number of different formats you could probably just interrogate the file extension of the uploaded file or a more structured way could be to have an additional field "FileType".

If you went for the second option you could use a gridview to display the Title/Description and then use a couple of BoundFields or HyperLink fields with a .pdf / .zip icon. This will then give your users the choice of format and just pass this back as a querystring:


Hope that helps you

Old September 19th, 2008, 12:47 AM
Authorized User
Join Date: Sep 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sully7

alright thanks guys! i got it working. I actually took your advice and created a related links section too hahaha

Similar Threads
Thread Thread Starter Forum Replies Last Post
Downloads/Resources Section for TBH Template retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 October 25th, 2007 05:28 PM
file downloads karunakar Struts 1 March 26th, 2007 01:29 AM
downloads JimBloomfield BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 June 23rd, 2006 09:17 AM
Downloads alexisb BOOK: Expert One-on-One Access Application Development 7 January 1st, 2005 10:24 PM
C# Downloads Mike Smith Wrox Book Feedback 3 December 14th, 2003 04:26 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.