Wrox Programmer Forums
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
Old September 13th, 2010, 12:12 PM
Registered User
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Page 104

The book has the following code:

public ActionResult Index(int page = 0) {

which gives me the following errror: "Default parameter specifiers are not permitted"

To get around this problem I use the following for the Index action method:

//GET: /Dinners/page/2
public ActionResult Index(int? page)
int displayPage = null == page ? 0 : (int)page;

const int pageSize = 10;

var dinners = dinnerRepository.FindUpcomingDinners();
var paginatedDinners = dinners.OrderBy(d => d.EventDate)
.Skip(displayPage * pageSize)
return View(paginatedDinners);

The page now works for:


Similar Threads
Thread Thread Starter Forum Replies Last Post
can’t open the page because the server where this page is located isn’t responding m_alsobaai Forum and Wrox.com Feedback 3 July 15th, 2010 06:13 AM
Page 104 Nicholsen BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 November 27th, 2008 05:37 AM
confuse page 104 kencheung BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 August 16th, 2004 03:32 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.