Programming ASP.NET 3.5

Errata for Programming ASP.NET 3.5

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 4
Figure 1-3 The .NET Framework Stack

The versions of C# and VB indicated in the figure are incorrect. They show respectively v2.0 and v8.0 when the correspounding paragraphs clearly state C# 3.0 and Visual Basic 9.0

Note from the Author or Editor:
Completely correct. Figure 1-3 should be altered so that C# v2.0 should read C# v3.0 and Visual Basic v8.0 should read Visual Basic v9.0

tsimbalar  Nov 21, 2009 
Printed
Page 101
3rd paragraph

Code specifies "strHtml += [TextBoxName].Value...". It should read "strHtml += [TextBoxName].Text...". Change ".Value" for ".Text".

Note from the Author or Editor:
As noted above, please change "strHtml += [TextBoxName].Value..." to read "strHtml += [TextBoxName].Text..."

Paul Balchin  May 18, 2010 
Printed
Page 106
Last paragraph

"Double-click btnHTML in Design view to create an event handler in the code-behind file." Actually, double-clicking on the HTML button in the Design view does not create the event handler or the code-behind file. Instead it adds a second onclick attribute to the element in the source for the aspx file, which the previous paragraph had instructed the reader to add the attributes onclick="javascript:ButtonTest();" and onserverclick="btnHTML_ServerClick"; the second onclick attribute is set to "return btnHTML_onclick()". Here's what that element looks like after double-clicking on btnHTML in Design view: <input id="btnHTML" type="button" value="HTML Button" runat="server" onclick="javascript:ButtonTest();" onserverclick="btnHTML_ServerClick" onclick="return btnHTML_onclick()" />

Note from the Author or Editor:
Change the last paragraph of page 106 to "Right click the page in Design view to display the code behind file for the page and add the following lines of code."

Bob Kline  Jun 07, 2009 
Printed
Page 109
2nd paragraph of note section in middle of page

"In both cases, you'll need administrative privileges to install it, and you can accept the default options." Well, of course, you can accept the default options, but if you do the example won't work on Vista, because by default IIS7 is installed without support for ASP.NET.

Note from the Author or Editor:
Change the final sentence of the second paragraph on p109 to In both cases, you'll need administrative privileges to install it. XP Users can accept the default options but Vista users will also need to select ASP.NET to be installed.

Bob Kline  Jun 07, 2009 
Printed
Page 147
8 lines from the bottom (code list)

The coordinates of the bottom PolygonHotSpot produce a polygon that does not align with the area in the image. It overlaps the 2nd polygon (too high) on the right side and is not high enough on the left side. The error is in the Coordinates parameter. This segment in error is: Coordinates="495,45,495,112,495,320,4,320" This value should be changed to: Coordinates="495,112,495,320,4,320,4,264"

Note from the Author or Editor:
COordinates should be changed as noted above

Tony Thornton  Feb 20, 2009 
Printed
Page 174
1st paragraph

The line in error is : ..., as shown in Example 4-34, ... It should be changed to : ..., as shown in Example 4-32, ...

Note from the Author or Editor:
As stated in the submitted errata, change "Example 4-32" to "Example 4-34"

bigqiang  Jun 14, 2009 
Printed
Page 184
1 line from the bottom

The line in error is : The values of the Target property are the same as those listed in Table 4-5 for the HyperLink control. It should be changed to : The values of the Target property are the same as those listed in Table 4-6 for the HyperLink control.

Note from the Author or Editor:
As stated in the submitted errata, change "Table 4-5" to "Table 4-6"

bigqiang  Jun 14, 2009 
Printed
Page 189
18 line from the top

The line in error is : ..., there is only a single BulletedList control and the ID is known to us: bltList. It should be changed to : ..., there is only a single BulletedList control and the ID is known to us: bltBooks.

Note from the Author or Editor:
As stated in the submitted errata, change bltList to bltBooks on line 18.

bigqiang  Jun 14, 2009 
Printed
Page 209
2nd Paragraph

2nd para. is: Now drag a DropPanelExtender from the Toolbox... 2nd para. should be: Now drag a DragPanelExtender from the Toolbox... DropPanelExtender sounds like a cross between DropShadowExtender and DragPanelExtender (the 2 controls being discussed in the section). At least I couldn't find any such name in the toolbox, and then this isn't errata.

Note from the Author or Editor:
In para 2 on page 209, change 'DropPanelExtender' to read 'DragPanelExtender'

Alejandro Gonzalez  Nov 28, 2009 
PDF
Page 234
4th paragraph commencing "Now add a message...."

You twice refer to the message and UpdatePanel, when in fact you are adding it to the UpdateProgress tag which is pointing to an UpdatePanel. You don't add the message to either of the Update Panels.

Note from the Author or Editor:
In the fourth paragraph on p234, change the two references to "UpdatePanel" to "UpdateProgress control".

PSO57  Aug 18, 2010 
PDF
Page 244
4th paragraph beginning "Run the page now....."

You seem to have got a little ahead of yourself here. You say run the page, but you have not yet defined the event handler for rblView_SelectedIndexChanged, so the compilation fails. You define this a little further down the same page, so perhaps a bit of reordering.

Note from the Author or Editor:
On page 244, move the fourth paragraph beginning 'Run the page now...' to below Example 5-16.

PSO57  Aug 18, 2010 
Printed
Page 263
Code example (Ex 5-24)

The FileUploadDemo has a coupla minor issues. In btnSave_Click() the code has an if (FileUpload1.HasFile) { ... } else { lblMessage.Text = "No file uploaded"; // NOTE THIS LINE } but this is never displayed to the user because a few lines later we see: lblMessage.Text = str.ToString(). which overrides the prior assignment. The noted line should be: str.Append("No file uploaded."); which will be properly reported to the user. -- This same issue appears in btnDisplay_Click() in the same example. --- Also in btnSave_Click, there are two outputs of the same data: str.AppendFormat("Saved as: {0}", FileUpload1.PostedFile.FileName); ... str.AppendFormat("PostedFile FileName: {0}", FileUpload1.PostedFile.FileName); The first one should probably be "FileUpload1.FileName";

Note from the Author or Editor:
As stated in the submitted errata, On p263, the line under "// show info about the file" should read str.AppendFormat("Saved as: {0}", "<c:\\SaveDirectory>" + FileUpload1.FileName); On p263, 7 lines up from the bottom of the page, change lblMessage.Text = "No file uploaded."; to read str.Append("No file uploaded"); On page 264, 6 lines from the bottom of the code listing, change lblMessage.Text = "No file uploaded."; to read str.Append("No file uploaded");

Steve Friedl  Jun 04, 2009 
PDF
Page 292
1st paragraph

You say recall that the WeekendDayStyle is set to the colour LavenderBlush, it isn't, that was in the Calendar-Styles.aspx exercise.

Note from the Author or Editor:
p292 - Replace the second sentence with the following. "Recall that in a previous exercise we showed how to set styles on a calendar control, including setting the WeekendDayStyle to LavenderBlush."

PSO57  Aug 24, 2010 
Printed
Page 306
Last paragraph, continuing on to page 307

In the second sentence you say "Though the end result of the Response.Redirect and the cross-page post appears the same, there is a fundamental difference". The rest of the paragraph goes on comparing Response.Redirect and Server.Transfer. I believe where is says "Server.Transfer" it should say "cross-page post".

Note from the Author or Editor:
Hi, I think I would go with this errata and make the changes as suggested. The paragraph in question applies equally in measure to both Server.Transfer and cross-page posting - hence the confusion - but in context it should be talking about cross-page posts.

Daniel Powers  Jan 24, 2009 
Printed
Page 331
Example 6-19 string[] Books =

The book shows the following string[] Books = { "SciFi", "Fiction", "Computers", "History", "Religion" }; However the code file downloaded has string[] Books = { "SciFi", "Novels", "Computers", "History", "Religion" }; When you run the page as it is in the book, page 334 Fig 6-10 should show Fiction. If you run the code file it will show Novels as shown.

Note from the Author or Editor:
The global.asax file for Chapter 6 should be altered so the appropriate line reads string[] Books = { "SciFi", "Fiction", "Computers", "History", "Religion" }; to match the book text

Patrick Delio  Dec 23, 2009 
PDF
Page 334
Figure 6-10

You already have a confirmed errata for page 331 where you have indicated that the 2nd element of the Books array should be "Fiction". If that is the case, then this figure should show the word Fiction not Novels.

Note from the Author or Editor:
Figure 6-10 should be retaken to reflect that Novels has been replaced by Fiction

PSO57  Aug 26, 2010 
PDF
Page 351
Last paragraph

This paragraph implies that figure 7-4 is what will be displayed in the design view, but figure 7-4 is what is displayed when the web page is RUN. Needs clarifying.

Note from the Author or Editor:
Change the last sentence of p351 to "You'll see the customer information created in the GetCustomers method displayed in a table when the page is run, as shown in Figure 7-4."

PSO57  Aug 27, 2010 
Printed
Page 376
bottom paragraph on the page

The text reads: "However, to make your work easier you can ask your data source control to create the remaining SQL CREATE, UPDATE, and DELETE statements using a wizard." But it should be INSERT, not CREATE.

Note from the Author or Editor:
As stated in the submitted errata, change "CREATE" to "INSERT"

Steve Friedl  Jun 08, 2009 
PDF
Page 404
Example 8-4

In the code for the CS file, you assign a string to lblInfo.Text, but there is no such control in DetailsView.aspx, so far in this example. You need to ask the reader to add this control further up the page.

Note from the Author or Editor:
p404. change the top sentence and code block as follows. To demonstrate, open DetailsView.aspx and set the DataKeyNames property as highlighted here. You'll also need to add a Label control to display the Customer details on the page: <asp:DetailsView ID="CustomerDetails" runat="server" DataSourceID="dsCustomers" AllowPaging="True" EmptyDataText="No data was found" DataKeyNames="CustomerID, RowGuid"> </asp:DetailsView> <p> <asp:Label runat="server" ID="lblInfo" /> </p>

PSO57  Sep 02, 2010 
PDF
Page 410
Paragraph commencing "You can add seven field...."

You say "field header column" don't you mean "field properties column".

Note from the Author or Editor:
p410. Seonc dparagraph. Replace 'field header column' with 'Selected fields' window.

PSO57  Sep 03, 2010 
Printed
Page 422
7 lines from the bottom

Error is: as listed earlier in Table 8-5. It should be changed to: as listed earlier in Table 8-6.

Note from the Author or Editor:
Correction should be made as noted above.

bigqiang  Mar 14, 2009 
Printed
Page 423
2 lines from the bottom

The error is EmptyDataText'Description in the Table 8-11. Error description is: Sets the text displayed by the DetailsView if the DataSource it is bound to returns no data to display It should be changed to: Sets the text displayed by the GridView if the DataSource it is bound to returns no data to display.

Note from the Author or Editor:
As noted above, the word DetailsView should be changed to the word GridView in the Description of the EmptyDataText property

bigqiang  Mar 14, 2009 
Printed
Page 424
19 lines from the top

The error is EmptyDataText'Description in the Table 8-11. Error is: Sets the CSS class name for the table generated by the DetailsView control. It should be changed to: Sets the CSS class name for the table generated by the GridView control.

Note from the Author or Editor:
The description of the CssClass property on p424 should start with "Sets the CSS class name for the table generated by the GridView control."

bigqiang  Mar 14, 2009 
Printed
Page 427
14 lines from the bottom

The error is: Figure 8-17 shows the results of running the page and selecting the first row. It should be changed to: Figure 8-17 shows the results of running the page and selecting the third row.

Note from the Author or Editor:
Please make change as noted in the errata above

bigqiang  Mar 15, 2009 
Printed
Page 430
lines 11,12 from the top

The error is: Extends the BoundField to render (a combination of) fields as hyperlinks in the DetailsView. It should be changed to: Extends the BoundField to render (a combination of) fields as hyperlinks in the GridView.

Note from the Author or Editor:
Please make change as noted in the errata above

bigqiang  Mar 15, 2009 
Printed
Page 430
17 lines from the bottom

The error is: change their command types depending on the current mode of the DetailsView. It should be changed to: change their command types depending on the current mode of the GridView.

Note from the Author or Editor:
Please make change as noted in errata above.

bigqiang  Mar 15, 2009 
Printed
Page 437
Last sentence

Text reads: "Bind does this too, but does not act as a two-way binding in templated controls." Bind does create a two-way binding, so the text should read something like: "Bind does this too, but acts as a two-way binding in templated controls."

Note from the Author or Editor:
The above sentence should read 'Bind does this too, and acts as a two-way binding in templated controls.'

Keith McMillan  Jun 15, 2010 
Printed
Page 449
17 lines from the top

The error is : Example 8-11. Repeater.aspx.cs in full It should be changed to : Example 8-11. Repeater.aspx in full

Note from the Author or Editor:
Please make change as noted in errata above.

bigqiang  Mar 17, 2009 
Printed
Page 454
12 lines from the top

The error is : ItemTemplate will be used for every item in the DataList. It should be changed to : ItemTemplate will be used for every item in the ListView.

Note from the Author or Editor:
Please make change as noted in errata above.

bigqiang  Mar 18, 2009 
Printed
Page 478
2nd line from the bottom

The error line is: // between Bug and Order Details on the OrderID key It should be changed to: // between Order and Details on the OrderID key

Note from the Author or Editor:
As stated above, the second line of text on the page // between Bug and Order Details on the OrderID key should be changed to // between Order and Details on the OrderID key

bigqiang  Aug 19, 2009 
Printed
Page 480
10,11 lines from the top

The line in error is : When OrderGridView was added to DataRelations.aspx, its DataKeyValues property was set to OrderID. It should be changed to : When OrderGridView was added to DataRelations.aspx, its DataKeyNames property was set to SalesOrderID.

Note from the Author or Editor:
Please make change as noted in errata above.

bigqiang  Mar 21, 2009 
Printed
Page 480
2rd paragraph

When OrderGridView was added to DataRelations.aspx, its DataKeyValues property was set to OrderID. When called, the UpdateDetailsGrid method asks the OrderGridView for its DataKeys collection. This returns a collection of the fields set in DataKeyValues for the row currently selected on the GridView-or in brief, the OrderID for the order currently selected in OrderGridView. ------------------------- The "DataKeyValues" in error line should be changed to "DataKeyNames".

Note from the Author or Editor:
Please correct as noted in the errata. p480, 2nd para. Change "This returns a collection of the fields set in DataKeyValues for the row..." to "This returns a collection of the fields set in DataKeyNames for the row..."

bigqiang  Apr 18, 2009 
Printed
Page 498
End of page

StoredProcedures.asps.cs code samples don't include definition of CreateOrderDetailsDataSet() method. Since the text directs us to delete all the code from DataRelations.aspx.cs, there's nowhere else for this method to come from. Code won't compile or run without the method. Downloadable example code does include this method.

Note from the Author or Editor:
The code for CreateOrderDetailsDataSet is missing from the code on page 497. Please add the following code between the CreateOrderDataSet and UpdateDetailsGrid methods on that page. private DataSet CreateOrderDetailsDataSet(int orderId) { SqlConnection connection = new SqlConnection(connectionString); // Create a DataAdapter for the SalesOrderHeader GridView SqlDataAdapter OrderDetailsAdapter = CreateAdapterForOrderDetails(connection, orderId); // Create the dataset and use the data adapter to fill it DataSet dataSet = new DataSet(); try { connection.Open(); OrderDetailsAdapter.Fill(dataSet); } finally { if (connection.State != ConnectionState.Closed) { connection.Close(); } } return dataSet; }

Keith McMillan  Jun 18, 2010 
Printed
Page 505
various methods in this chapter's section

in the click event handler methods of the Add and Edit buttons, you pass a value of type StringBuilder to the UpdateDB method which only accepts an argument of type string, as does the SqlCommand type, respectively. you can keep the command strings as type StringBuilder for all of the event handler methods if you wish to be consistent, and change UpdateDB's cmdString argument to be of type StringBuilder, however, you then must convert the string argument to be of type string inside the UpdateDB method in order to feed it to SqlCommand: SqlCommand command = new SqlCommand(cmdString.ToString(), connection); which means you would also have to update the Delete button's click event handler method's deleteCommand variable to be of type StringBuilder as well when passing it onto the UpdateDB method, otherwise you'll get build errors.

Note from the Author or Editor:
Change the btnAdd_Click, btnEdit_Click and btnDelete_Click functions on page 505 to the following protected void btnAdd_Click(object sender, EventArgs e) { String insertCommand = String.Format("insert into SalesLT.ProductCategory ([ParentProductCategoryID], [Name]) values ('{0}', '{1}')", ddlParentCategory.SelectedValue, txtName.Text); UpdateDB(insertCommand); PopulateGrid(); } protected void btnEdit_Click(object sender, EventArgs e) { String updateCommand = String.Format("Update SalesLT.ProductCategory SET Name='{0}', ParentProductCategoryID='{1}' where ProductCategoryID='{2}'", txtName.Text, ddlParentCategory.SelectedValue, hdnCategoryID.Value); UpdateDB(updateCommand); PopulateGrid(); } protected void btnDelete_Click(object sender, EventArgs e) { string deleteCommand = String.Format("delete from SalesLT.ProductCategory where ProductCategoryID ='{0}'", hdnCategoryID.Value); UpdateDB(deleteCommand); PopulateGrid(); }

Rey de la Torre  Feb 08, 2009 
Printed
Page 505
btnEdit_Click event handler method

When creating or appending to StringBuilder types on a new line, you cannot use {1} or {2}; they must start at {0} again: updateCommand.AppendFormat("Name='{0}', ", txtName.Text); updateCommand.AppendFormat("ParentProductCategoryID='{1}' ", ddlParentCategory.SelectedValue); // this line produces a zero-base FormatException error however, when changing {1} to {0} due to a new call to updateCommand.AppendFormat(), the error goes away and the page behaves as expected.

Note from the Author or Editor:
Change the listing for btnEdit_Click on page 505 to... protected void btnEdit_Click(object sender, EventArgs e) { String updateCommand = String.Format("Update SalesLT.ProductCategory SET Name='{0}', ParentProductCategoryID='{1}' where ProductCategoryID='{2}'", txtName.Text, ddlParentCategory.SelectedValue, hdnCategoryID.Value); UpdateDB(updateCommand); PopulateGrid(); }

Rey de la Torre  Feb 08, 2009 
Printed
Page 553
Example 10-9

The first line of PageLoad tries to load an XML document using: XElement.Load(Request.ApplicationPath+"\\authors.xml"); this yields a wrong path, code should read: XElement.Load(Request.MapPath("~/authors.xml")); which will map the file path correctly to the filesystem.

Note from the Author or Editor:
On page 553, the first highlighted line of code should be changed to read XElement doc = XElement.Load(Request.ApplicationPath+"\\authors.xml");

Keith McMillan  Jun 23, 2010 
Printed
Page 590
Ninth line from end of page

ID for the text box control should be "txtPageNumber", not "txtNumPurch"

Note from the Author or Editor:
The code at the bottom of page 590, line 4, should read <asp:TextBox ID="txtPageNumber" runat="server" />

Keith McMillan  Jun 24, 2010 
Printed
Page 609
1rd paragraph

The following link is invalid: http://www.iis.net/go/928, http://www.iis.net/go/1023, http://www.iis.net/go/1027 So, pls update these link.

Note from the Author or Editor:
Please replace the three links above with the following. http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis7/ http://learn.iis.net/page.aspx/244/how-to-take-advantage-of-the-iis7-integrated-pipeline/ http://learn.iis.net/page.aspx/377/using-aspnet-forms-authentication/

bigqiang  Apr 18, 2009 
Printed
Page 694
2rd paragraph

The line in error is : ..., and the Text property of that SiteMapNode returns that SiteMapNode's title. It should be changed to : ..., and the Title property of that SiteMapNode returns that SiteMapNode's title.

Note from the Author or Editor:
In the 2nd paragraph, replace "and the Text property of that SiteMapNode returns that SiteMapNode's title." with "and the Title property of that SiteMapNode returns that SiteMapNode's title."

bigqiang  Apr 18, 2009 
Printed
Page 695
Second paragraph

This paragraph refers to specific accounts that were supposed to have been created as part of the previous chapter, chapter 12. No such instructions to create accounts are in chapter 12. A simple language change to "create the following accounts" would probably be fine.

Note from the Author or Editor:
On page 631, step number 4. The first sentence should read "Fill in the details for the new user, as shown in Figure 12-14 with password Dan@123, and click Create User." On page 633, step number 4. The final sentence should read "You will be prompted to add a new user, as shown in Figure 12-14. Set the password to Jesse@123." On page 642, add the following new sentence to the end of the paragraph beginning "To demonstrate, ". "You'll also need to create a third user account 'Jane' with password Jane@123."

Keith McMillan  Jun 29, 2010 
Printed
Page 697
Third line from bottom of page

The last SiteMapNode element in the site map includes an attribute "securityTrimmingEnabled" which is not valid for this element type. Correct text should be: <siteMapNode url="~/Login.aspx" title="Login" description="Login"/>

Note from the Author or Editor:
The third to last line of Example 13-9 should read <siteMapNode url="~/Login.aspx" title="Login" description="Login"/>

Keith McMillan  Jun 29, 2010 
Printed
Page 721
Last line of method Profile_MigrateAnonymous

clearing the favoriteBooks list owned by the anonymous profile isn't causing that profile to be updated in the database: anonymousProfile.Save needs to be called for this to happen. We're also leaving the user with both a signed in ID, and an anonymous ID, and we should probably clear out the anonymous ID: ProfileManager.deleteProfile(e.AnonymousID); Additionally, we can remove the client side cookie for the anonymous ID: AnonymousIdentificationModule.ClearAnonymousIdentifier(); and get rid of the membership row altogether: Membership.DeleteUser(e.AnonymousID);

Note from the Author or Editor:
On page 721, the following four lines of code should be included after the line anonymousProfile.favoriteBooks.Clear(); anonymousProfile.Save(); ProfileManager.deleteProfile(e.AnonymousID); AnonymousIdentificationModule.ClearAnonymousIdentifier(); Membership.DeleteUser(e.AnonymousID);

Keith McMillan  Jun 30, 2010 
Printed
Page 738
14 lines from the bottom

The line in error is : Example 14-12 DisplayMode.aspx in full It should be changed to : Example 14-12 DisplayModeMenu.ascx in full

Note from the Author or Editor:
Change the caption for the code sample at the bottom of page 738 to Example 14-12 DisplayModeMenu.ascx in full Change the caption for the code sample at the bottom of page 739 to Example 14-13 DisplayModeMenu.ascx.cs in full

bigqiang  Apr 18, 2009 
Safari Books Online
755
6th

public int NumOfColumns { get { return numOfColumns; } set { numOfColumns = value; } } public RepeatDirection direction { get { return direction; } set { direction = value; } } when you declare the above 2 public properties, the second one "direction" is written exactly as the next instruction where you initialize the private members. private int numOfColumns = 3; private RepeatDirection direction = RepeatDirection. Horizontal; So, the compiler shows an error, because that variable "direction" is delcared two times. the Solution is to declare the property with this name "Direcion" and that is it. Regards...

Note from the Author or Editor:
On Page 755, capitalise the name of the public property from 'direction' to 'Direction'

Development TI  Mar 24, 2010 
Printed
Page 1095
line 17-24 from the top

The error is: ... Debug > Windows > Watch > Memory 1 ... ... Debug > Windows > Watch > Memory 2 ... ... Debug > Windows > Watch > Memory 3 ... ... Debug > Windows > Watch > Memory 4 ... It should be changed to: ... Debug > Windows > Memory > Memory 1 ... ... Debug > Windows > Memory > Memory 2 ... ... Debug > Windows > Memory > Memory 3 ... ... Debug > Windows > Memory > Memory 4 ...

Note from the Author or Editor:
As stated above, change ... Debug > Windows > Watch > Memory 1 ... ... Debug > Windows > Watch > Memory 2 ... ... Debug > Windows > Watch > Memory 3 ... ... Debug > Windows > Watch > Memory 4 ... to ... Debug > Windows > Memory > Memory 1 ... ... Debug > Windows > Memory > Memory 2 ... ... Debug > Windows > Memory > Memory 3 ... ... Debug > Windows > Memory > Memory 4 ...

bigqiang  Jul 01, 2009