Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Professional ASP.NET MVC 2
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 11:47 AM
NerdDinner Dinner.cs errors (System.ComponentModel.DataAnnotations?) LorenMaxwell BOOK: Professional ASP.NET MVC 2 1 January 2nd, 2011 03: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



All times are GMT -4. The time now is 03:16 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.