 |
BOOK: Professional ASP.NET MVC 2
 | This is the forum to discuss the Wrox book Professional ASP.NET MVC 2 by Jon Galloway, Scott Hanselman, Phil Haack, Scott Guthrie, Rob Conery; ISBN: Professional ASP.NET MVC 2 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional ASP.NET MVC 2 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
|
|
|
|

September 9th, 2010, 07:52 AM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
Errata
Here are some of the errors I have found, that have you frustrated wondering if it is you or the book that is the problem:
page 30:
"entities.RSVPs.DeleteObject(dinner.RSVPs);" is wrong, should be "entities.RSVPs.DeleteObject(rsvp);"
page 35:
"[StringLength(265, ErrorMessage =" is wrong, should be "[StringLength(256, ErrorMessage ="
page 61:
The descriptions associated with the EventDate and ContactPhone fields in Figure 1-84 are inconsistent with the code. Adding a DisplayName attribute to the properties in your Dinner partial class will allow you to change the labels. This same problem is evident in other figures later in the book.
page 73:
The code for the create.aspx view will not create the look that is in figure 1-94. This is sorted out later when you implement a partial view based on the edit.aspx view, so don't worry about it.
page 89:
It is not clear from the code that the code on your edit view will now be like this:
<%: Html.LabelFor(m => m.Dinner.Title) %>
Instead of this:
<%: Html.LabelFor(m => m.Title) %>
i.e. Where "m." was present before it will be replaced by "m.Dinner." throughout the code in the view.
page 90:
As we are now using a DinnerFormViewModel in the view the TryUpdate in code snippet 1-53 needs to be changed.
"if (TryUpdateModel(dinner))" needs to be changed to "if (TryUpdateModel(dinner,"Dinner"))"
page 107:
You need to fully qualify the model you are inheriting from, i.e. you need to use this:
<NerdDinner.Helpers.PaginatedList<NerdDinner.Model s.Dinner>>
instead of this which is suggested in the book:
<NerdDinner.Helpers.PaginatedList<Dinner>>
|
The Following 4 Users Say Thank You to frez For This Useful Post:
|
|

September 21st, 2010, 02:29 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Please help me. My problem is :
I created private NerdDinnerEntities object 'entities'. There are two model classes in Entity i.e. Dinner and RSVPs. While implementing Insert/Delete method in DinnerRepository Class i stuck at entities.Dinner. because there is know Addobject() available neither the DeleteObject(). I couldnt even access entities.RSVPs instead intelissence shows entities.RSVPsSet
Help me out.
Thanks...
|

September 25th, 2010, 02:29 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
About PaginatedList class
where to add PaginatedList<T> class in the project.
|

September 25th, 2010, 02:36 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
PaginatedList
<NerdDinner.Helpers.PaginatedList<NerdDinner.Mod el s.Dinner> Will you explain Helpers come from where?
|

September 26th, 2010, 06:49 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
[DisplayName] attribute problems?
Hi, thats a very usefull errata, many thanks. One problem though on the page 61 tip, when I try to change the display names by adding a [DisplayName] attribute to the Dinner Partial class, when I start to type [DisplayName], it does not appear as an option in the intellisense?
I am using the System.ComponentModel.DataAnnotations reference and the [Required] and [StringLength] attributes work OK. Not sure what I am doing wrong?
|

September 26th, 2010, 06:59 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
Quote:
Originally Posted by Mossyman
Hi, thats a very usefull errata, many thanks. One problem though on the page 61 tip, when I try to change the display names by adding a [DisplayName] attribute to the Dinner Partial class, when I start to type [DisplayName], it does not appear as an option in the intellisense?
I am using the System.ComponentModel.DataAnnotations reference and the [Required] and [StringLength] attributes work OK. Not sure what I am doing wrong?
|
You need to add a using System.ComponentModel to the Dinner partial class, then you can add the attribute, e.g. [DisplayName("Event Date")]
|
The Following User Says Thank You to frez For This Useful Post:
|
|

September 26th, 2010, 07:00 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
Quote:
Originally Posted by dpuranik
<NerdDinner.Helpers.PaginatedList<NerdDinner.Mod el s.Dinner> Will you explain Helpers come from where?
|
Helpers is a new folder you need to create that will contain the PaginatedList class.
|

October 4th, 2010, 10:08 PM
|
Registered User
|
|
Join Date: Oct 2010
Posts: 2
Thanks: 5
Thanked 0 Times in 0 Posts
|
|
Page 89
On the top of page 89 - they say to change the Inherits attribute like so:
Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NerdDinner.Controllers.DinnerFormViewModel>" %>
but shouldn't it be more like so?
Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NerdDinner.Models.DinnerFormViewModel>" %>
Because on page 94, DinnerFormViewModel reappears on the screenshot - and it clearly states NerdDinner.Models.DinnerFormViewModel
I swear this book is a mystery novel.
|

October 5th, 2010, 04:32 AM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
Quote:
Originally Posted by firedrawndagger
I swear this book is a mystery novel.
|
Lol, well chapter 1 is for sure, in fact I never bothered finishing it all, however, once you have finished that hurdle the rest of the book is very good.
|

October 7th, 2010, 10:20 AM
|
Friend of Wrox
|
|
Join Date: Oct 2010
Posts: 106
Thanks: 1
Thanked 17 Times in 17 Posts
|
|
m.Title versus m.Dinner.Title
Another way to fix issue on page 89 is to use a Custom-Shaped ViewModel Class (which is mentioned in page 91).
Just modify your existing DinnerFormViewModel.cs to expose individual properties of Dinner:
Code:
public string Title
{
get { return Dinner.Title; }
set { Dinner.Title = value; }
}
If you expose just the properties needed for the view, you can still use
<%: Html.LabelFor(m => m.Title) %> in the view.
Also, since the view never directly references Dinner, you can make it private.
There are times where it is very useful to be able to shape the view like this (remember "separation of concearns"). Look at m.Title versus m.Dinner.Title. Think about this. What would happen if you swapped out the Dinner model with something new like FineDining model? You could then change the viewmodel and not change anything in the view. If needed you could "translate" property names like this:
Code:
public string Title
{
get { return FineDining.MyFineTitle; }
set { FineDining.MyFineTitle= value; }
}
Using this modified ViewModel has apparently fixed issue with page 90. So using "if (TryUpdateModel(dinner))" works now. And doesnt need to be changed to "if (TryUpdateModel(dinner,"Dinner"))"
btw, thanks to all who contributed here. It really helped me out.
Last edited by flyinhawaiian; October 7th, 2010 at 11:01 AM..
Reason: added code tags
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Errata |
Eddierocks |
BOOK: JavaScript Programmer's Reference |
14 |
March 31st, 2011 12:54 PM |
A new errata |
Cookie Chen |
C# |
1 |
November 12th, 2007 05:12 AM |
Errata |
omarosa |
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 |
7 |
October 6th, 2005 09:21 AM |
Errata |
edsmithed |
BOOK: Professional Java Development with the Spring Framework |
4 |
August 9th, 2005 04:32 PM |
Errata |
ursjenzer |
BOOK: Professional Assembly Language |
0 |
July 5th, 2005 09:05 AM |
|
 |
|