Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Professional ASP.NET MVC 2
|
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 June 9th, 2011, 06:32 AM
Registered User
 
Join Date: Jun 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default NerdDinner: Index.aspx only displays last dinner entry

Hello,

I've run into a problem with the index.aspx file. It appears to be written out just like in the book, but it displays only the final item in my Dinners table. I have five items altogether in the table.

To see if it was an issue with the loop I removed the fifth/final dinner from the dinners table to see if it would instead display the fourth one. Instead it came up blank. Navigating to individual dinners is fine (e.g. .../dinners/details/3).

Here is the aspx file, hope someone can point out the issue with it, or where else I may have gone wrong. Thanks.

EDIT - Just to mention, this is from pages 51-53 of the book.

Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<NerdDinner.Models.Dinner>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Upcoming Dinners</h2>

    <ul>
        <% foreach (var dinner in Model)
           { %>

        <li>
            <%: dinner.Title%>
            on
            <%: dinner.EventDate.ToShortDateString()%>
            @
            <%: dinner.EventDate.ToShortTimeString()%>
        </li>

        <% } %>
    </ul>


</asp:Content>

Last edited by bbcc66; June 9th, 2011 at 06:38 AM.. Reason: left out info
 
Old June 9th, 2011, 06:46 AM
Registered User
 
Join Date: Jun 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please ignore the above. I realised that the dates in my dinners table where mostly past ones and that the file looks for upcoming dinners. Sorry!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Publishing nerd dinner to server flyinhawaiian BOOK: Professional ASP.NET MVC 2 5 February 11th, 2011 12:47 PM
NerdDinner Dinner.cs errors (System.ComponentModel.DataAnnotations?) LorenMaxwell BOOK: Professional ASP.NET MVC 2 1 January 2nd, 2011 04:12 AM
Nerd Dinner Help - Page 32 yosofun BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 0 June 20th, 2010 09:44 PM
NerdDinner The view 'Index' or its master could not be found rthorington BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 3 May 3rd, 2009 04:30 PM





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