Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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 October 7th, 2011, 03:08 AM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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();
}
}
}
Reply With Quote
  #2 (permalink)  
Old October 7th, 2011, 04:16 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
Old October 7th, 2011, 05:14 AM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #4 (permalink)  
Old October 7th, 2011, 05:41 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #5 (permalink)  
Old October 7th, 2011, 09:43 AM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #6 (permalink)  
Old October 7th, 2011, 12:03 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 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!
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
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



All times are GMT -4. The time now is 10:46 AM.


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