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 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 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 Display Modes
  #1 (permalink)  
Old March 18th, 2011, 08:45 AM
Authorized User
Points: 145, Level: 2
Points: 145, Level: 2 Points: 145, Level: 2 Points: 145, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old March 18th, 2011, 09:25 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
TeaDrinkingGeek (March 18th, 2011)
  #3 (permalink)  
Old March 18th, 2011, 10:14 AM
Authorized User
Points: 145, Level: 2
Points: 145, Level: 2 Points: 145, Level: 2 Points: 145, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #4 (permalink)  
Old March 18th, 2011, 10:25 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 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!
Reply With Quote
Reply


Thread Tools
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
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 03:34 PM
Ch14 - timesheets with one row geoffers BOOK: Beginning VB.NET Databases 0 August 24th, 2005 09:48 AM



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


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