Wrox Programmer Forums
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 21st, 2006, 01:14 PM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Nested Repeaters three deep?

I am creating a report that displays each user of the system, a date sub header, and then the work completed for each date. I am using repeaters nested three deep.

Such that:

<asp:repeater id="rprUser" runat="server">
<asp:repeater id="rprWork" runat="server">
<asp:repeater id="rprWorkDetail" runat="server">

But for some reason it doesn't populate that third repeater. What am I doing wrong?

Here's the code:

quote:Public Class WorkCompletedDetail
    Inherits clsErrorPage

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents lblCompletedBy As System.Web.UI.WebControls.Label
    Protected WithEvents rprWorkDetail As System.Web.UI.WebControls.Repeater
    Protected WithEvents rprWork As System.Web.UI.WebControls.Repeater
    Protected WithEvents frmWork As System.Web.UI.HtmlControls.HtmlForm

    Protected WithEvents cpvWorkDate_StartEnd As System.Web.UI.WebControls.CompareValidator
    Protected WithEvents cpvWorkDate_Start As System.Web.UI.WebControls.CompareValidator
    Protected WithEvents cpvWorkDate_End As System.Web.UI.WebControls.CompareValidator
    Protected WithEvents lblFilterWorkDate As System.Web.UI.WebControls.Label
    Protected WithEvents txtWorkDate_Start As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtWorkDate_End As System.Web.UI.WebControls.TextBox

    Protected intCount As Integer = 0
    Protected intReqNum As Integer = 0
    Protected dblWorked As Double = 0

    Protected WithEvents btnGo As System.Web.UI.WebControls.Button
    Protected WithEvents rprUser As System.Web.UI.WebControls.Repeater

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If Not IsPostBack Then
            txtWorkDate_Start.Text = DateAdd(DateInterval.Day, -7, DateTime.Now).ToString("MM/dd/yyyy")
            txtWorkDate_End.Text = DateTime.Now.ToString("MM/dd/yyyy")
        End If

    End Sub

    Private Sub rprWorkDetail_ItemDatabound(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rprWorkDetail.ItemDataBound

        Select Case e.Item.ItemType

            Case ListItemType.AlternatingItem, ListItemType.Item

                'Set the section's totals
                Dim strWorked As String
                Dim strReqNum As String

                strWorked = CType(e.Item.FindControl("lblWorkHours"), Label).Text
                If strWorked = "" Then
                    strWorked = "0"
                End If

                strReqNum = CType(e.Item.FindControl("lblReqNum"), Label).Text
                If strReqNum = "" Then
                    strReqNum = "0"
                End If

                dblWorked = dblWorked + Double.Parse(strWorked)
                intReqNum = intReqNum + Integer.Parse(strReqNum)

        End Select

    End Sub

    Private Sub rprWork_ItemDatabound(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rprWork.ItemDataBound

        Select Case e.Item.ItemType

            Case ListItemType.Item, ListItemType.AlternatingItem

                'Set the nested repeater
                Dim lblUserIDWork As Label = CType(e.Item.FindControl("lblUserWorkID"), Label)
                Dim lblDate As Label = CType(e.Item.FindControl("lblWorkDate"), Label)
                Dim rprWorkCompletedDetail2 As Repeater = CType(e.Item.FindControl("rprWorkDetail"), Repeater)

                rprWorkCompletedDetail2.DataSource = clsReports.GetMyWorkCompletedDetail(CInt(lblUserID Work.Text), CDate(lblDate.Text))

                intCount = intCount + 1

            Case ListItemType.Footer

                CType(e.Item.FindControl("lblTotalCount"), Label).Text = intCount.ToString
                CType(e.Item.FindControl("lblReqNumTotal"), Label).Text = intReqNum.ToString
                CType(e.Item.FindControl("lblTotalWorked"), Label).Text = dblWorked.ToString

        End Select

    End Sub

    Private Sub rprUsers_ItemDatabound(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rprUser.ItemDataBound

        Select Case e.Item.ItemType

            Case ListItemType.Item, ListItemType.AlternatingItem

                Dim lblUserID As Label = CType(e.Item.FindControl("lblUserID"), Label)
                Dim lblUser As Label = CType(e.Item.FindControl("lblUser"), Label)
                Dim rprWork2 As New Repeater
                Dim objSelectedUser As New clsUser(CInt(lblUserID.Text))

                rprWork2 = CType(e.Item.FindControl("rprWork"), Repeater)

                Dim dvwWork As DataView
                Dim objStatus As clsStatus

                dvwWork = clsReports.GetMyWorkCompleted(objSelectedUser.ID)

                If txtWorkDate_Start.Text <> "" And txtWorkDate_End.Text <> "" Then
                    dvwWork.RowFilter = "WorkDate >= '" & txtWorkDate_Start.Text & "'"
                    dvwWork.RowFilter += "AND WorkDate <= '" & txtWorkDate_End.Text & "'"
                End If

                rprWork2.DataSource = dvwWork

                If dvwWork.Count = 0 Then
                    'lblUser.Visible = False
                    rprWork2.Visible = False
                End If

            Case ListItemType.Separator

                Dim lblFooter As Label = CType(e.Item.FindControl("lblFooter"), Label)
                Dim lblUser As Label = CType(e.Item.FindControl("lblUserFooter"), Label)

                If intCount = 0 Then
                    lblFooter.Text = "There were no results that matched your criteria."
                End If

                intCount = 0
                intReqNum = 0
                dblWorked = 0

        End Select

    End Sub

    Private Sub BindData()

        Dim dvwUsers As DataView

        dvwUsers = clsUser.GetAll().Tables(clsUser.GetAllTableName).D efaultView

        dvwUsers.RowFilter = "FullName Not Like '%Select%'"
        rprUser.DataSource = dvwUsers

    End Sub

    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click


    End Sub

End Class

Similar Threads
Thread Thread Starter Forum Replies Last Post
please help deep nested looping rsf0031 XSLT 7 June 20th, 2007 04:03 PM
Nested Repeaters, need inner rptr to know which... thenoseknows ASP.NET 2.0 Professional 0 May 27th, 2007 08:31 PM
Nested Repeaters darylh2004 ASP.NET 2.0 Basics 0 July 6th, 2006 04:14 AM
Nested Repeaters to create hierarchy Lord__Chaos ASP.NET 2.0 Basics 0 May 26th, 2006 12:37 PM
dynamic menu from nested repeaters Jacko ASP.NET 1.0 and 1.1 Professional 1 March 6th, 2006 06:51 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.