- Steve McNiven
This post will outline how to easily (re: no code) bind nested repeaters with telerik OpenAccess.
So lets start off with our class definition, we need to make sure the class we’re binding to has a Generic List property which has a one-to-many mapping to another table. In my case I have a Categories table, and an Items table…
So using the reverse mapping wizard I made sure I had a one-to-many mapping to the Items table inside the Categories table…this is the generated code
Ok, so now that we have that we need to open our page code and add a repeater. This is going to be the MASTER
So now for the detail repeater, we’re just going to throw it inside the ItemTemplate of the parent like this
Notice the Datasource of the Detail\Child repeater is set right to our GenericList Collection Property of the Category object?..that’s all there is too it! Booya, instant nested repeater.
The last thing left to do is give the master it’s DataSource Collection of Catagory Objects
…and we do that like this
(Helper being a class I use to manage the scope without needing to get scope objects all over the place)