Nested repeater inside another nester repeater
Posted on 2006-11-28
I am trying to build a comments report wich is 3 levels deep. The top level is the 'Department' next level is the 'department's comments' then finally, the 'Products' that the comments was assigned.
For this I have a repeater that brings up a list of departments for a given date range that have comments, then I have a nested repeater to show the comments for each department. Now I need a 3rd repeater that will show the products for the comments since the customer service guys can select products and those get saved in a separate table that relates to the comment by comment and product ID.
For my first nested repeater I have this:
'Get the list of comments for the given department
Protected Sub rpt_report_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rpt_report.ItemDataBound
'Get variables to send to stored proc
Dim startDate As String = Request.Form("txt_dateStart")
Dim endDate As String = Request.Form("txt_dateEnd")
Dim depId As Integer = e.Item.DataItem("depId")
'Attach datasource to repeater
Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("conn"))
'Call the stored procedure we need
Dim sql As String = "exec sp_rpt_departments_10" & "'" & startDate & "'," & "'" & endDate & "'," & depId
Dim ds As New DataSet
Dim da As SqlDataAdapter
da = New SqlDataAdapter(sql, conn)
Dim nestedRpt As New Repeater
nestedRpt = e.Item.FindControl("rpt_comments")
'Find nested repeater
If ds.Tables(0).Rows.Count > 0 Then
nestedRpt.DataSource = ds.Tables(0)
nestedRpt.Visible = False
That works just fine, my question is, how do I access the ItemDataBound event of the nested repeater so that I can give the 3rd repeater a datasource based on the row id from the second repeater.
Thanks in advance, I really need this one.