Results 1 to 2 of 2

Thread: Nested repeater control and custom dataset

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Location
    india
    Posts
    95

    Nested repeater control and custom dataset

    hi

    im using nested repeater control in asp.net page.
    two control names are:
    1. packg -outer repeater
    2. rptr - inner repeater


    now the datasource for packg (outer control) is comming from database
    and the datasourcer for rptr (inner control) is my own datatable.

    how to bind this in my page.



    '----------coding im using in ItemDataBound of outer repater control----

    Private Sub packg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles packg.ItemDataBound
    If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
    Dim rpt As Repeater = CType(e.Item.FindControl("rptr"), Repeater)
    If Not (rpt Is Nothing) Then
    Dim WsI As Integer
    Dim WsCart As New DataTable()
    WsCart.Columns.Add(New DataColumn("tempcol", GetType(String)))
    WsCart.Columns.Add(New DataColumn("DivId", GetType(String)))
    For WsI = 1 To 3
    Dim WsRow As DataRow = WsCart.NewRow
    WsRow("tempcol") = "rptr__ctl" & WsI & "_txtTitl," & "rptr__ctl" & WsI & "_txtLstNm," & "rptr__ctl" & WsI & "_txtfstNm," & "rptr__ctl" & WsI & "_lstadt"
    WsRow("Divid") = "rptr__ctl" & WsI & "_"
    wsDetStr = wsDetStr & "::" & WsRow("DivId")
    WsCart.Rows.Add(WsRow)
    Next


    rptr.DataSource = '---here i want to bind the second repeater
    rptr.DataBind()
    End If
    End If
    End Sub

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Nested repeater control and custom dataset

    Have you tried...

    VB Code:
    1. Private Sub packg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles packg.ItemDataBound
    2. If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
    3. Dim rpt As Repeater = CType(e.Item.FindControl("rptr"), Repeater)
    4. If Not (rpt Is Nothing) Then
    5. Dim WsI As Integer
    6. Dim WsCart As New DataTable()
    7. WsCart.Columns.Add(New DataColumn("tempcol", GetType(String)))
    8. WsCart.Columns.Add(New DataColumn("DivId", GetType(String)))
    9. For WsI = 1 To 3
    10. Dim WsRow As DataRow = WsCart.NewRow
    11. WsRow("tempcol") = "rptr__ctl" & WsI & "_txtTitl," & "rptr__ctl" & WsI & "_txtLstNm," & "rptr__ctl" & WsI & "_txtfstNm," & "rptr__ctl" & WsI & "_lstadt"
    12. WsRow("Divid") = "rptr__ctl" & WsI & "_"
    13. wsDetStr = wsDetStr & "::" & WsRow("DivId")
    14. WsCart.Rows.Add(WsRow)
    15. Next
    16.  
    17.  
    18. [b]rptr.DataSource = WsCart[/b]
    19. rptr.DataBind()
    20. End If
    21. End If
    22. End Sub
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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