+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 19 of 19

Thread: reference control from nested repeater

  1. #11
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    when i change:
    Code:
    For categoryCount = 0 To rpActiveCategory.Items.Count - 1
    
                Dim rpSubCategory As Repeater = CType(rpActiveCategory.Items(categoryCount).FindControl("rpActiveSubCategory"), Repeater)
                For subcategoryCount = 0 To rpSubCategory.Items.Count - 1
    
                    Dim rpSpecs As Repeater = CType(rpSubCategory.Items(subcategoryCount).FindControl("rpActiveSpecs"), Repeater)
                    For specsCount = 0 To rpSpecs.Items.Count - 1
    
    to:
    Code:
    For categoryCount = 0 To rpActiveCategory.Items.Count - 1
    
                Dim rpSubCategory As Repeater = CType(rpActiveCategory.Items(categoryCount).FindControl("rpActiveSubCategory"), Repeater)
                For subcategoryCount = 0 To rpSubCategory.Items.Count - 1
    
                    Dim rpSpecs As Repeater = CType(rpSubCategory.Items(subcategoryCount).FindControl("rpActiveSpecs"), Repeater)
                    For Each Item as RepeaterItem in rpSpecs.Items
    
    I get the same error

    I also changed them all to look like your example and then i got some error
    pertaining to item, saying it hides a enclosing block or summing to that effect?

    Shem

  2. #12
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    this is the example i was going against:
    Code:
    I have It !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.  
    I Set another loop inside the parent loop.
           
           Dim nCount As Integer = 0
            Dim nchildCount as Integer = 0
            For nCount = 0 To ParentRepeater.Items.Count -1
               Dim Repeater1 as DataList= CType(ParentRepeater.Items(ncount).FindControl("childrepeater"), DataList)
    
               For nChildCount = 0 to Repeater1.Items.Count -1
                    Dim cb as Checkbox = CType(Repeater1.Items(nchildCount).FindControl("chkbox1"), CheckBox)
                    If cb.Checked then
                        lstSelected.Items.Add(cb.text)            '
                    End if
               Next
            Next
    

  3. #13
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    is there anyway I could achieve this with just one repeater?
    I don't have time to sit on issues this long?

    Shem

  4. #14
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Are the repeaters nested or separate from eachother?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  5. #15
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    nested in this order:

    1. rpActiveCategory
    2. rpActiveSubCategory
    3. rpActiveSpecs

    rpActiveSubCategory is populted in rpActiveCategory's OnItemDataBound,
    but i need to be able to populate rpSpecs in a seperate sub via calling it
    as i need it populated in 2 diff places, also i need to reference rpActiveSpecs
    controls in another seperate sub that deals with sorting by columns.

    and it seems impossible to reference rpActiveSpecs controls outside of OnItemDataBound

  6. #16
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I'm trying to understand your logic here, so bare with me...

    What do you mean by "populated in 2 different places"? Would you elaborate on that a little more?

    Are you trying to use a subroutine to read from an already populated repeater and populate another repeater?

    Typically, OnItemDataBound is the best place for this type of thing...and I can't think of any good reason not to use it.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #17
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    what i mean by that is have my databind code in a sub that i can call to
    bind data to rpActiveSpecs.

    logic for this is if some other sub eg Update sub, updates or changes
    data, i want to re-populate rpActiveSpecs so that it shows the latest(updated)
    data.

    make sense?

    anywho, i might be on to something, will let ya know if it works

  8. #18
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    this (for now) does actually work:
    Code:
    For categoryCount = 0 To rpActiveCategory.Items.Count - 1
    
                Dim rpSubCategory As Repeater = CType(rpActiveCategory.Items(categoryCount).FindControl("rpActiveSubCategory"), Repeater)
                For subcategoryCount = 0 To rpSubCategory.Items.Count - 1
    
                    Dim rpSpecs As Repeater = CType(rpSubCategory.Items(subcategoryCount).FindControl("rpActiveSpecs"), Repeater)
                    For specsCount = 0 To rpSpecs.Items.Count - 1
    
    I was being stupid and too rush about it, was trying to access controls that were not
    sitting in rpActiveSpecs what a numpty hey!

    Shem
    Last edited by Shem; September 15th, 2008 at 11:54 AM.

  9. #19
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    lol it happens...glad you were able to get a working solution
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. VBScript Functions Reference
    By jmurrayhead in forum ASP Development
    Replies: 25
    Last Post: October 21st, 2008, 09:31 AM
  2. Access parent repeater item from child repeater
    By Shem in forum .NET Development
    Replies: 10
    Last Post: September 9th, 2008, 06:03 AM
  3. paging enabled in a repeater control
    By peebman2000 in forum .NET Development
    Replies: 6
    Last Post: September 4th, 2008, 12:15 PM
  4. convert repeater to pdf
    By peebman2000 in forum .NET Development
    Replies: 4
    Last Post: August 18th, 2008, 10:39 AM
  5. Dynamically Reference Worksheet Cell/Range
    By BLaaaaaaaaaarche in forum Microsoft Office
    Replies: 2
    Last Post: June 18th, 2008, 04:59 PM

Bookmarks

Posting Permissions

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

SEO by vBSEO