Wiley
Wiley.com
Print this page Share

ASP.NET 2.0 Instant Results

ISBN: 978-0-471-74951-6
480 pages
March 2006
ASP.NET 2.0 Instant Results (0471749516) cover image
ASP.NET 2.0 Instant Results helps you quickly create dynamic Web pages with ASP.NET 2.0. The book is centered around a dozen ready-to-use projects with all the code for all the projects included on the books CD-ROM - that you can use immediately. ASP.NET 2.0 Instant Results dives into working code so you can learn it rapidly. The book and projects are written for intermediate-level programmers with some .NET experience. The projects and book provide a quick start reference so you can use ASP.NET 2.0 immediately.

Each of the 12 project features step-by-step set-up instructions with a description of each project that enables you to understand and then modify it so you can reuse it in different situations.

The 12 projects covered in the book with complete source-code on the CD are:

  • Online diary and organizer
  • File share
  • Chat server
  • Survey engine
  • CMS
  • Blog
  • Photo album
  • Customer support site
  • WebShop
  • Appointment booking system
  • Greeting cards
  • Bug base

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

See More
Acknowledgments.

Introduction.

Chapter 1: The Online Diary and Organizer.

Chapter 2: Wrox File Share.

Chapter 3: Wrox Chat Server.

Chapter 4: Wrox Survey Engine.

Chapter 5: Wrox CMS.

Chapter 6: Wrox Blog.

Chapter 7: Wrox Photo Album.

Chapter 8: Customer Support Site.

Chapter 9: Wrox WebShop.

Chapter 10: Appointment Booking System.

Chapter 11: Greeting Cards.

Chapter 12: The Bug Base.

Index.

See More
Imar Spaanjaars graduated in Leisure Management from the Leisure Management School in the Netherlands, but quickly changed his career path into the Internet world. After working for a large corporation and doing some freelance work, he is now working for Design IT, an IT company in the Netherlands that specializes in Internet and Intranet applications built with Microsoft technologies like ASP.NET. As a software designer and lead developer, he’s responsible for designing, building, and implementing medium- to large-scale e-commerce web sites and portals.
Before this book on ASP.NET 2.0, Imar wrote two books about Macromedia Dreamweaver, called Beginning Dreamweaver MX and Beginning Dreamweaver MX 2004, both published under the Wrox brand.
Imar is also one of the top contributors to the Wrox Community Forums at http://p2p.wrox.com where he shares his knowledge with fellow programmers.
Imar lives in Utrecht, the Netherlands. You can contact him through his web site at http://imar.spaanjaars.com.

Paul Wilton got an initial start as a Visual Basic applications programmer at the Ministry of Defense in the UK before finding himself pulled into the Net. Having joined an Internet development company, he spent three years helping create Internet solutions. He’s now running his own company developing online holiday property reservation systems.
Paul’s main skills are in developing web front ends using DHTML, JavaScript, and VBScript as well as back-end solutions with ASP, ASP.NET, Visual Basic, and SQL Server.

Shawn Livermore (MCAD, MCSD, PMP) [shawnlivermore.blogspot.com] has been architecting and developing Microsoft-based solutions for nearly a decade. Shawn consults as an architect for Fortune 500 clientele, leveraging time-proven methodologies and exceptional communications, within highly visible projects. His range of technical competence stretches across platforms, but specializes within Microsoft .NET development and server-based products such as Biztalk and SQL Server, among others.
His experience implementing enterprise-level Microsoft solutions is extensive and has led to successful business ventures with numerous firms.

See More
Download TitleSizeDownload
Download Bonus Content
Download this .zip file to get twelve additional walkthroughs that guide you through modifying and extending each of the applications in the book.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

680.78 KB Click to Download
Download Code for Chapter 1 - Online Diary
Download a .zip file with the installer for the Chapter 1 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

502.28 KB Click to Download
Download Code for Chapter 2 - File Share Install
Download a .zip file with the installer for Chapter 02.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

3.92 MB Click to Download
Download Code for Chapter 2 - File Share Source
Download a .zip file with the Chapter 2 project source code.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

3.25 MB Click to Download
Download Code for Chapter 2 - File Share Source with Enhancement
Download a .zip file with the working project code for Chapter 02 modified to match the Chapter 2 bonus content download walkthrough.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

3.67 MB Click to Download
Download Code for Chapter 3 - Chat Server
Download a .zip file with the installer for the Chapter 3 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

1.71 MB Click to Download
Download Code for Chapter 4 - Wrox Survey Engine
Download a .zip file with the installer for the Chapter 4 working project code and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

8.17 MB Click to Download
Download Code for Chapter 4 - Wrox Survey Engine Source
Download a .zip file with the project source code for Chapter 04.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

3.93 MB Click to Download
Download Code for Chapter 5 - Wrox CMS
Download a .zip file with the installer for the Chapter 5 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

3.84 MB Click to Download
Download Code for Chapter 5 - Wrox CMS Update

This zip file contains an updated version of the CMS database and the web.config file for the chapter 5 CMS application. Copy these files over the copy the existing ones from the CD or the main chapter 5 download to fix a login problem with the CMS application.

313.91 KB Click to Download
Download Code for Chapter 6 - Wrox Blog
Download a .zip file with the installer for the Chapter 6 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

4.16 MB Click to Download
Download Code for Chapter 7 - Wrox Photo Album
Download a .zip file with the installer for the Chapter 7 working project code and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

7.67 MB Click to Download
Download Code for Chapter 7- Wrox Photo Album Source
Download a .zip file with the project source code for Chapter 07.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

3.73 MB Click to Download
Download C# Code for Chapter 7- Wrox Photo Album Source
Unsupported! Download a .zip file with the project source code in C# for Chapter 07. This code is provided by a user, not Wrox, and is available "as-is" with no official support from Wrox.
3.74 MB Click to Download
Download Code for Chapter 8 - Customer Support Site
Download a .zip file with the installer for the Chapter 8 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

4.05 MB Click to Download
Download Code for Chapter 9 - Wrox WebShop
Download a .zip file with the installer for the Chapter 9 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

2.25 MB Click to Download
Download Code for Chapter 10 - Appointment Booking
Download a .zip file with the installer for the Chapter 10 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

1.79 MB Click to Download
Download Code for Chapter 11 - Greeting Cards
Download a .zip file with the installer for the Chapter 11 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

500.05 KB Click to Download
Download Code for Chapter 12 - The Bug Base
Download a .zip file with the installer for the Chapter 12 working project code, the project source code, and a modified version of the source code to match the bonus content download walkthrough modifications.

To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.

1.84 MB Click to Download
See More

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
Chapter 4 Website Errata Online
Chapter 4 – Survey Engine
Issue: Corrupt database in the code download

There is a problem with the database that comes with the code download, as it contains an out-dated stored procedure. When you try to login to the site, you get a nasty IndexOutOfRangeExceptionexception.

To fix this problem, follow these steps:

Delete the ASPNETDB database from the App_Data folder (both the MDF and LDF files)

Open the site in your browser (Ctrl+F5 in Visual Web Developer) and try to login in. This will fail, but a new ASPNETDB database has been created automatically in the App_Data folder.

Run the Website Administration Tool (choose Website | ASP.NET Configuration) and create a new role called Admin. Next, create a new user called Admin (choose your own password) and assign this user to the new role.

Open the site in your browser again. You should now be able to login with the account created in step 3.
7/27/06
5 Chapter 5 code updated

Chapter 5 - To correct a login problem with the CMS application, please see the download page for a zip file containing an update for 3 files in the application.

7-20-2006
Chapter 5 Code Replacement
Chapter 5 – CMS
Issue – Database in the code download has incorrect information about the application

The database that comes with the code download has incorrect information about the application and its users. An updated database has been made available in the code download page for this book.

This zip file contains an updated version of the CMS database and the web.config file for the chapter 5 CMS application. Copy these files over the copy the existing ones from the CD or the main chapter 5 download to fix a login problem with the CMS application.
7/27/06
5 Chapter 5 Section Error
Issue: Problem with deleting content

There is a problem with the Management section of the CMS site, similar to the problem in the Customer Support site. In the Management section, you can no longer delete a content item. You do get the confirmation dialog, but after that the page doesn’t post back and the item is never deleted. The reason for this problem is that the ASP.NET run-time has changed the button from input type=”submit” to input type=”button”. With the confirmation dialog added to this button, it no longer automatically submits to the server. The fix is easy. The next steps describe how to fix the ContentList page:

Open the ContentList.aspx page from the Management folder in Design View.

Open the Smart Task of the GridView and choose Edit Columns.

Locate the Delete column and convert it to a template by clicking the blue link at the bottom of the dialog. You should end up with something like this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Button ID="Button1" runat="server"
CausesValidation="false" CommandName="Delete"
Text="Delete" />
</ItemTemplate>
</asp:TemplateField>

Modify the code so you end up with this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Button ID="Button1" runat="server"
CausesValidation="False"
CommandName="Delete" Text="Delete"
OnClientClick="return confirm('Are you sure you want to
delete this content item?');"
/>
</ItemTemplate>
</asp:TemplateField>

Notice how the OnClientClick property was added.

Because the client side confirmation box is now added in the markup, you no longer need the event handler for the RowCreated event in the code behind. So, you can delete the entire gvContent_RowCreated Sub routine from the code behind file.

Request the page in your browser. You should now be able to delete content items.
7/27/06
6 202 Incorrect Password
first text paragraph following the numbered list, last line:
incorrect password:
Admin123#

should be:
Admin#123

Note: for errata website: Notice that for the SQL Server 2005 database,
the password remains Admin123#, as stated on page 201.
7/27/06
Chapter 8 Section Error
Chapter 8 – Customer Support
Issue: Problem with deleting content

There is a problem with the Management section of the Customer Support Site. In the Management section, deleting of products and downloads no longer work. You do get the confirmation dialog, but after that the page doesn’t post back and the item is never deleted. The reason for this problem is that the ASP.NET run-time has changed the button from input type=”submit” to input type=”button”. With the confirmation dialog added to this button, it no longer automatically submits to the server. The fix is easy. The next steps describe how to fix the Products page, but the same principle applies to other pages in the Management section:

Open the Products page in Design View.

Open the Smart Task of the GridView and choose Edit Columns.

Locate the Delete column and convert it to a template by clicking the blue link at the bottom of the dialog. You should end up with something like this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Button ID="Button1" runat="server"
CausesValidation="false" CommandName="DeleteItem"
Text="Delete" />
</ItemTemplate>
</asp:TemplateField>

Modify the code so you end up with this:

< asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Button ID="Button1" CommandArgument='<%# Eval("Id") %>'
runat="server" CausesValidation="false"
CommandName="DeleteItem" Text="Delete"
OnClientClick="return confirm('Are you sure you want to delete this product?');" />
</ItemTemplate>
</asp:TemplateField>

Notice how the CommandArgument and OnClientClick properties were added.

Because the command argument now contains the product ID, you need to change some code in the code behind as well.

Locate the gvProduct_RowCommand event handler and change the case for deleteitem to this:

Case "deleteitem"
productId = Convert.ToInt32(e.CommandArgument)
Product.Delete(productId)
gvProduct.DataBind()

Request the page in your browser. You should now be able to delete products.
7/13/09
Chapter 8 Section Error
Chapter 8 – Customer Support
Issue: Problem with adding a second level category.

When you try to add a second level category in the Management section of the Customer Support Site, you may receive this error:

Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.

The error is caused by the fact that the selection on the existing dropdown is not cleared before it is databound again. To fix the problem, open the file Categories.aspx.vb from the Management folder and replace the method UpdateDropDown with the following code:

Private Sub UpdateDropDown(ByVal listNumber As Integer)
Select Case listNumber
Case 1
lstCategoryLevel1.DataBind()
lstCategoryLevel1.ClearSelection()
lstCategoryLevel1.Items.FindByText
(txtLevel1.Text).Selected = True
txtLevel1.Text = ""
Case 2
lstCategoryLevel2.DataBind()
lstCategoryLevel2.ClearSelection()
lstCategoryLevel2.Items.FindByText
(txtLevel2.Text).Selected = True
txtLevel2.Text = ""
Case 3
lstCategoryLevel3.DataBind()
lstCategoryLevel3.ClearSelection()
lstCategoryLevel3.Items.FindByText
(txtLevel3.Text).Selected = True
txtLevel3.Text = ""
End Select
End Sub

Notice that in each Case block, a call to ClearSelection was added.

From now on, you can successfully add new categories at all levels.
7/27/06
10 337-338 Error in Code
On page 337 - 338 there is a stored procedure called sprocAppointmentCheckAvailability. This procedure is missing a critical WHERE clause that may result in overlapping reservations (e.g. that occur on the same time of day for the same booking object).

To fix the problem, add an additional line to the WHERE clause on page 338. That is, change

WHERE

(@startDate >= StartDate AND @startDate < EndDate)

OR (@endDate > StartDate AND @endDate <= EndDate)

))



to:

WHERE

(@startDate >= StartDate AND @startDate < EndDate)

OR (@endDate > StartDate AND @endDate <= EndDate)

OR (@startDate <= StartDate AND @endDate >= EndDate)

))
1/26/09
Chapter 12 Section Error
Chapter 12 – BugBase
Issue: Priority of a bug always remains 3

There’s a problem on the AddEditBug.aspx page. Whenever you change a bug’s priority and revisit the AddEdit page, the priority appears to have been reset to 3. Here’s how to fix the problem:

Open AddEditBug.aspx.vb from the Bugs folder.

Scroll down to around line number 75.

Right below the End If of the code that sets the selected item for the lstStatus control, and before the line that sets the page title, change the code to read:

If lstStatus.Items.FindByValue(myBug.Status.Value.ToString()) IsNot
Nothing Then
lstStatus.Items.FindByValue(myBug.Status.Value.ToString()).Selected =
True
End If
lstPriority.ClearSelection()
If lstPriority.Items.FindByValue(myBug.Priority.ToString()) IsNot Nothing
Then
lstPriority.Items.FindByValue(myBug.Priority.ToString()).Selected = True
End If
txtTitle.Text = myBug.Title
txtDescription.Text = myBug.Description

This code clears the current selection (the default Selected item of "3", set in the markup for the lstPriority control) and then sets its new selected index by looking at the Priority property of the bug.
7/27/06
See More

Related Titles

Back to Top