Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old February 2nd, 2010, 03:40 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
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



All times are GMT -4. The time now is 06:42 AM.


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