Displaying hierarchical data with the LinqDataSource

I ran into some frustration playing with the new LinqDataSource last night.  I was creating a FAQ page for a site and needed to show the Category followed by the list of questions/answers in that category.  This involved having a repeater nested within a parent repeater which was bound to a LinqDataSource.  The child repeater was then bound to the "Faqs" collection of the FaqCategory table.  The Linq to Sql designer is shown below as well as the repeater. 

 

After setting this up, I was not able to get the actual questions to display in the nested repeater.  I thought Linq would delay execution of the query to return the entire object graph.  I finally tried setting EnableUpdate attribute to "true" and was finally able to get the entire object graph. Hopefully this will save others some frustration.

4 Comments

Comments have been disabled for this content.