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 October 7th, 2011, 03:08 AM
Registered User
 
Join Date: Sep 2011
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default chapter 13 , Bullets Reviews not displaying

Hi

I request prompt response, Thanks in advance

Following is 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") %>' EnableViewState="True"> </asp:Literal>

</h3>
<asp:BulletedList ID="lstReviews" runat="server" lDataSource='<%# Eval("reviews")%>' DataTextField="title" DisplayMode="Text">
</asp:BulletedList>
</ItemTemplate>
</asp:Repeater>
</asp:Content>

Following aspx.cs
-------------------
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 : System.Web.UI.Page
{
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 October 7th, 2011, 04:16 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I request prompt response, Thanks in advance
To what? You're not even asking a question....

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 October 7th, 2011, 05:14 AM
Registered User
 
Join Date: Sep 2011
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default chapter 13 , Bullets Reviews not displaying

you are correct.

I mean the reviews (collection) is not display its repeated Data in following :

<asp:BulletedList ID="lstReviews" runat="server" lDataSource='<%# Eval("reviews")%>' DataTextField="title" DisplayMode="Text">
</asp:BulletedList>

i have put lDataSource above, because in DataSource it was giving Error.

But, incode file i have given
Repeater1.DataSource = allGenres;

the repeated data of <asp:Literal ID="Literal1" runat="server" Text='<%# Eval("name") %>' EnableViewState="True"> </asp:Literal>

is appearing properly.
 
Old October 7th, 2011, 05:41 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
i have put lDataSource above, because in DataSource it was giving Error.
It's DataSource, not IDataSource

What error do you get? Please be specific when posting questions here; the more relevant information you provide, the easier it is for me or others to answer your questions.

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!
 
Old October 7th, 2011, 09:43 AM
Registered User
 
Join Date: Sep 2011
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default chapter 13 , Bullets Reviews not displaying

i was getting below error , when the keyword was DATASOURCE.



Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.

Source Error:

Line 9:
Line 10: </h3>
Line 11: <asp:BulletedList ID="lstReviews" runat="server" DataSource='<%# Eval("reviews")%>' DataTextField="title" DisplayMode="Text">
Line 12: </asp:BulletedList>
Line 13: </ItemTemplate>


Regards
 
Old October 7th, 2011, 12:03 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Except for the casing your code looks fine. Is Reviews (or reviews) indeed a collection of reviews in your code? Did you set uo the database model correctly?

Can you try it with the code from the book? That can rule out a code issue. If it works then, the problem is in the database.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 12 Management.reviews is not allowed bc it does not extend system.web.ui.page tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 August 5th, 2011 10:35 AM
Chapter 4:Displaying the reviews p.126-128 drgnhiker BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 6 November 6th, 2010 04:04 AM
Bullets not getting displayed in IE prabhu shankar XSLT 2 March 10th, 2010 09:43 PM
problems with the reviews table in chapter 4 derrida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 March 15th, 2007 03:58 AM
display bullets in a datagrid.. sarah lee ASP.NET 1.0 and 1.1 Basics 2 September 1st, 2006 12:29 PM





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