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

October 7th, 2011, 03:08 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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();
}
}
}
|
|

October 7th, 2011, 04:16 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
I request prompt response, Thanks in advance
|
To what? You're not even asking a question....
Imar
|
|

October 7th, 2011, 05:14 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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.
|
|

October 7th, 2011, 05:41 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 7th, 2011, 09:43 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 7th, 2011, 12:03 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |