Wiley.com
Print this page Share

ASP.NET 2.0 Instant Results

ISBN: 978-0-471-74951-6
Paperback
480 pages
March 2006
ASP.NET 2.0 Instant Results (0471749516) cover image
This title is out-of-print and not currently available for purchase from this site.

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

Related Titles

More By These Authors

General Web Site Development

by Bill Evjen, Kent Sharkey, Thiru Thangarathinam, Michael Kay, Alessandro Vernet, Sam Ferguson
by Wallace B. McClure, Scott Cate, Scott Glavich, Craig Shoemaker
by Steve Holzner
by Doug Lowe, Ken Cox, Jeffrey M. Cogswell
Back to Top