Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 January 17th, 2010, 03:34 PM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 56
Thanks: 17
Thanked 2 Times in 2 Posts
Default Ch13 Pages 439-441 - No Titles!

I followed the Try-It-Out between pages 439-431.
But when I ran the code the titles were not displayed in my browser. (Ref Figure 13.5)
The bulleted lists appear with a blank line between the genres - but the genre titles are not displayed.

The code is below this text.
Anyone any idea where I have gone wrong?
Ken

AllByGenre.aspx
Code:
%@ Page Title="Reviews Grouped By Genre" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="AllByGenre.aspx.cs" Inherits="Reviews_AllByGenre" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
  <asp:Repeater ID="Repeater1" runat="server">
  <ItemTemplate>
  <h3><asp.literal id="Literal1" runat="server" text='<%# Eval("Name")%>'></asp.literal></h3>
    <asp:BulletedList ID="lstReviews" runat="server" DataSource='<%# Eval ("Reviews") %>' DataTextField="Title" DisplayMode="Text" />
  </ItemTemplate>
  </asp:Repeater>
</asp:Content>
AllByGenre.aspx.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Reviews_AllByGenre : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (PlanetWroxDataContext myDataContext = new PlanetWroxDataContext())
        {
            var allGenres = from genre in myDataContext.Genres
                            orderby genre.Name
                            select new { genre.Name, genre.Reviews };

            Repeater1.DataSource = allGenres;
            Repeater1.DataBind();
        }
    }
}
 
Old January 17th, 2010, 04:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi ken,

You may want to check your code against what VWD writes for you when you drag, say, a Literal into a page:

<h3><asp.literal id="Literal1" runat="server" text='<%# Eval("Name")%>'></asp.literal></h3>

See the difference? You have a period between asp and Literal while you should use a colon.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
ken evans (January 17th, 2010)
 
Old January 17th, 2010, 04:35 PM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 56
Thanks: 17
Thanked 2 Times in 2 Posts
Default

Yes - But at least I was consistent!
I had put a period in both the opening and the closing tags.
My titles are now in view!
Thanks Imar

Last edited by ken evans; January 17th, 2010 at 04:36 PM.. Reason: correction





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the correct code on page 441 - 442? Grace BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 4 July 13th, 2009 06:20 AM
past titles oxygen_fiend All Other Wrox Books 1 September 6th, 2005 10:49 AM
Page titles do not show as they should Ruben@Adafi Dreamweaver (all versions) 2 October 26th, 2004 02:23 AM
error found Chapter 10 pg 439 dogfish227 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 April 8th, 2004 01:08 PM
old titles and their source... oxygen_fiend Forum and Wrox.com Feedback 1 November 28th, 2003 03:49 AM





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