|
 |
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|

September 8th, 2010, 07:14 PM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
PaginatedList
Ok,
So I'm supposed to change the Inheritance from
<IEnumerable<Dinner>>
to
<NerdDinner.Helpers.PaginatedList<Dinner>>
That's fine, but when you do this the page blows up. The main error seems to be that it cannot find the Dinners namespace (which is really really weird).
The entire class doesn't make much sense to me either. If we are now passing the PaginatedList to the view as the model, then the class doesn't have any type of public property for the dinners iteration.
|

September 9th, 2010, 07:45 AM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 5
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
This is because they don't mention you need to fully qualify your model, i.e.
<NerdDinner.Helpers.PaginatedList<NerdDinner.Model s.Dinner>>
|
The Following User Says Thank You to frez For This Useful Post:
|
|

September 14th, 2010, 05:29 AM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Speaking of the paginated list...when they first mention it in Page 106 and show the code, it's a pity that they don't display the full name space.
We've got a class file to create but not a location as to where it should be stored. If you download the text file source code this info is missing there too!
It's only half way down page 107 when the authors give us our first clue as to where to store the file!
btw: namespace NerdDinner.Helpers!
A bit of proof reading might have been helpful pre-book launch! :)
Last edited by kinvig; September 14th, 2010 at 05:37 AM..
Reason: Bad grammar!
|

October 14th, 2010, 04:08 PM
|
Registered User
|
|
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The code examples in the book are horrible.
Did anyone proofread the NerdDinner chapters??
Code doesn't match up with text. Missing code. No namespaces in examples.
For example the Helpers folder is not even mentioned...ANYWHERE.
The download code is a waste...copy of wrong code in book.
This book is a turd with stink, flush it.
two words for you....PROOF - READ
three more...DO - NOT - BUY
|

October 14th, 2010, 04:20 PM
|
Registered User
|
|
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Free Book Offer - Reply To This Thread!
Reply to this thread if you think they should send us a voucher for a free book. This book was obviously not ready for publishing.
|

October 14th, 2010, 05:51 PM
|
Friend of Wrox
|
|
Join Date: Oct 2010
Location: Seattle
Posts: 106
Thanks: 1
Thanked 17 Times in 17 Posts
|
|
There's a dozen more issues after page 107. I found all the workarounds I needed in this forum, plus I added a few more I encountered.
If you run into an issue, please browse the forums for a solution or post your questions here and I'll try to help (no, I don't work for Wrox).
|

October 15th, 2010, 08:04 AM
|
Registered User
|
|
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Default parameter specifiers are not permitted
Hello,
When i try to do this:
public ActionResult Index(int page = 0) (page 107) i get the message
Default parameter specifiers are not permitted
What to do?
greetz
|

October 15th, 2010, 10:09 AM
|
Friend of Wrox
|
|
Join Date: Oct 2010
Location: Seattle
Posts: 106
Thanks: 1
Thanked 17 Times in 17 Posts
|
|
@Ewi2010 Default parameters was introduced in C# 4.0. Sounds like you're not using the most updated Visual Studio. What version are you using? I'm using VS 2010 Ultimate. You should be able to use VS 2010 Express.
Get VS2010 Express, ASP.Net, ASP.NET MVC, SQL Server Express for free at http://www.asp.net/downloads
If you insist on using older C#, you might get around this by removing the default AND creating an overrided Index action method. This is not recommended.
Last edited by flyinhawaiian; October 15th, 2010 at 10:24 AM..
|

October 15th, 2010, 10:11 AM
|
Registered User
|
|
Join Date: Sep 2010
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Quote:
public ActionResult Index(int page = 0) (page 107)
|
Which IDE are you using? I beleive the default parameters are a Visual Studio 2010 feature only. If you're not using VS2010 you'll have to use:
Code:
public ActionResult Index([DefaultValue(0) int page)
{...}
|

October 18th, 2010, 01:50 PM
|
Registered User
|
|
Join Date: Oct 2008
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My Dinner table only hzs 21 records.
This gets around the optional parameter prohibition and default value ( int page = 0) prohibition in VS 2008:
publicActionResult Index(paramsint[] Page)
{
int page = 0;
if (Page != null){
page = (int)Page[0];
}
const int pageSize = 3;
var upcomingDinners = dinnerRepository.FindUpcomingDinners();
var paginatedDinners = upcomingDinners.OrderBy(d => d.EventDate)
.Skip(page * pageSize)
.Take(pageSize)
.ToList();
return View(paginatedDinners);
}
Last edited by kermit1965; October 19th, 2010 at 03:46 PM..
Reason: Cleaner code
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |
All times are GMT -4. The time now is 10:59 PM.
|