Results 1 to 3 of 3

Thread: Can you nest a datarepeater in a datarepeater

  1. #1

    Thread Starter
    Hyperactive Member scuzymoto's Avatar
    Join Date
    Aug 1999
    Location
    Washington State
    Posts
    316

    Can you nest a datarepeater in a datarepeater

    I have a table whose records I want to display in a highly formatted way. The datarepeater works great for this, have used it many times. I am in a scenario now however that requires me to not only display records from that table but sub records from a child table. I instantly thought, no problem Ill just nest another repeater. Come data binding time however I didn't know how to go about it since the child records are based on a index key that is not known until the first repeater runs. Anyone know a good way to do this?
    SCUZ

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: Can you nest a datarepeater in a datarepeater

    What you need to do is execute the databind of the child repeater within the OnItemDataBound event of the parent repeater. Give a shout if you need more info.

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  3. #3

    Thread Starter
    Hyperactive Member scuzymoto's Avatar
    Join Date
    Aug 1999
    Location
    Washington State
    Posts
    316

    Re: Can you nest a datarepeater in a datarepeater

    How do I declare and initialize the second datarepeater. I added the code for a second datarepeater in the event as described. But the code did not recognize it. So I tried adding it to the declaration list like this...

    Protected WithEvents Repeater2 As System.Web.UI.WebControls.Repeater

    This made the red lines go away in my code but when I compiled it and tried to run it I still got the following error on that line.

    System.NullReferenceException: Object reference not set to an instance of an object.
    SCUZ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width