The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Nested Repeater

1 reply on 1 page. Most recent reply: Jul 26, 2006 9:33 PM by Gary Vidal

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Michael Mello

Posts: 100
Nickname: knarf
Registered: May, 2004

Michael Mello is .NET Web Developer
Nested Repeater Posted: Jul 9, 2004 1:06 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Michael Mello.
Original Post: Nested Repeater
Feed Title: melloblog
Feed URL: http://www.thauvin.net/errorpage.htm?aspxerrorpath=/Default.aspx
Feed Description: .NET and Everything After.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Michael Mello
Latest Posts From melloblog

Advertisement
I recently had a need to display some hierarchical data in one of my report pages at work.  I wanted to use the nested repeater method, but wasn't quite sure how to implement it efficiently.  Luckily I found this great knowledge base article from Microsoft called: Display Hierarchical Data by Using Nested Repeater Controls and Visual C# .NET

I try to use the SqlDataReader extensively, but hitting the database for each record in a nested repeater control would not be a sound solution.  This is where the disconnected objects of the .NET framework come in handy, and more specifically; the DataSet and DataAdapter.  I'll provide a quick rundown here of the solution, but reference the Microsoft article for a full explanation.

Note: I'm bypassing the creation of the nested repeater markup for simplicity.

  1. Create one DataSet and two DataAdapter objects - one for each result set that you'll obtain from the database.

  2. After each result set is returned, use the DataAdapter to fill the DataSet.

  3. Your DataSet will now contain two tables (one for each query that was returned), and with those tables, you will make a relation to link the tables.

  4. Simply bind your parent repeater control, and you're on your way.


There was one thing in the article that I was unsure of, and here is the code from the .aspx:


<itemtemplate>

            <%# DataBinder.Eval(Container.DataItem, "[\"title_id\"]")%>

</itemtemplate>



You'll notice the field "title_id" has some funky syntax, and I haven't been able to figure out why it's necessary, for this to work; any ideas?

Read: Nested Repeater


Gary Vidal

Posts: 1
Nickname: garyvidal
Registered: Jul, 2006

Re: Nested Repeater Posted: Jul 26, 2006 9:33 PM
Reply to this message Reply
You might want to take a look at this code project
http://www.codeproject.com/useritems/Hierarchical_Repeater.asp. I had the same problem and came up with this solution

Flat View: This topic has 1 reply on 1 page
Topic: Re: Twelve benefits for doing TDD Previous Topic   Next Topic Topic: Twelve benefits for doing TDD

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use