Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 March 18th, 2011, 07:45 AM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default Ch14, Try out pg493

Hi Imar,

I've been experimenting with your code on pg 493, 494.

I wanted to add another Review field into the repeater.

I wrote this:

Code:
<asp:BulletedList ID="BulletedList1" runat="server" DataSource='<%# Eval("Reviews")%>' DataTextField="Summary" DisplayMode="Text">
                   </asp:BulletedList>
It displays the summary of reviews fine but in this format:

PUNK
--->Title
--->Title

--->Summary
--->Summary

How can I get it to display like:

PUNK
--->Title
--->Summary

--->Title
--->Summary

?

Regards
TDG
 
Old March 18th, 2011, 08:25 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This won't work as each bulleted list renders it's own set of items. What you could instead is use a nested Repeater and define controls for the title and the summary. Something like this should work:

Code:
<asp:Repeater ID="Repeater1" runat="server">
  <ItemTemplate>
    <h3><asp:Literal ID="Literal1" runat="server" Text='<%# Eval("Name") %>'></asp:Literal></h3>
    <asp:Repeater runat="server" DataSource='<%# Eval("Reviews")%>' >
      <ItemTemplate>
        <h4><asp:Literal ID="Literal1" runat="server" Text='<%# Eval("Title") %>' /><br /></h4>
        <p>
        <asp:Literal ID="Literal2" runat="server" Text='<%# Eval("Summary") %>' />
        </p>
      </ItemTemplate>
    </asp:Repeater>
  </ItemTemplate>
</asp:Repeater>
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!
The Following User Says Thank You to Imar For This Useful Post:
TeaDrinkingGeek (March 18th, 2011)
 
Old March 18th, 2011, 09:14 AM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Thanks Imar,

I thought you might have to have a nested query to get the info.
 
Old March 18th, 2011, 09:25 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You already have a nested set of data, where each genre holds a number of reviews. In this example, the outer Repeater displays the top level genres, while the inner Repeater displays the nested reviews.

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
Ch14 Try It Out Pg. 506 eiviery BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 November 11th, 2009 02:01 PM
My VB Code for Ch14 PatFrank BOOK: Beginning ASP.NET 2.0 and Databases 8 April 17th, 2007 02:34 PM
Ch14 - timesheets with one row geoffers BOOK: Beginning VB.NET Databases 0 August 24th, 2005 08:48 AM





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