View Single Post
  #1 (permalink)  
Old February 28th, 2013, 01:54 PM
hanci hanci is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2013
Location: Delft, Netherlands
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Chapter 3 - Passing Data from the Layout to a Section

The code for the Footer as show on the top of page 73 is:

Code:
@RenderPage("~/Shared/_Footer.cshtml", new (Year = DateTime.Now.Year))
This gave me two errors:

(1) "Compiler Error Message: CS1031: Type expected"

And then, after I added a type:

(2) "Compiler Error Message: CS0103: The name 'Year' does not exist in the current context"

The code that worked finally:

Code:
@RenderPage("~/Shared/_Footer.cshtml", new DateTime (Page.Year = DateTime.Now.Year))
I couldn't find the errata, is this an error in the code in the book (which, I think, is very good, in every aspect!)?
Reply With Quote