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 February 2nd, 2010, 02:11 PM
Authorized User
 
Join Date: Dec 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 13:page 439,Queries and Anonymous types

Hi,

I am working on try it out on page 439. After following all the steps, when i run page AllByGenre.aspx in browser, I only get bulleted list, I don't get name of the Genre. Here is the mark up of the page
Code:
<%@ Page Title="All reviews bygenre" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="AllByGenre.aspx.cs" Inherits="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") %>'/></h3>
    <asp:BulletedList ID="lstReviews" runat="server" DataSource='<%#Eval("Reviews")%>' DataTextField="Title" DisplayMode="Text">
    </asp:BulletedList> 
  </ItemTemplate>
  </asp:Repeater>
</asp:Content>
and here is the code from AllByGenre.aspx.cs

Code:
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class 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();
      }
    }
}
Anyone pls help me out, where am i making mistake?

Arya
 
Old February 2nd, 2010, 03:40 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 there,

You're missing the # symbol in the Eval statement for the Name property in the Literal...

Hope this helps,

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!
 
Old February 2nd, 2010, 11:22 PM
Authorized User
 
Join Date: Dec 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you very much Imar,
Arya





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page 468-474 Chapter 13 michaelcode BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 24th, 2006 09:00 AM
Chapter 13 page 444 DRAYKKO Beginning VB 6 1 April 19th, 2006 07:10 PM
error found Chapter 10 pg 439 dogfish227 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 April 8th, 2004 01:08 PM





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