Reference nested repeater's controls

Last post 09-15-2008, 4:51 AM by Shem. 0 replies.
Sort Posts: Previous Next
  •  09-15-2008, 4:51 AM Post number 69526

    • Shem is not online. Last active: 09-15-2008, 8:43 AM Shem
    • Not Ranked
    • Joined on 09-15-2008
    • Level 1: Deep thought

    Reference nested repeater's controls

    Hi guys

    I have 3 repeater controls:
    Code:
    rpActiveCategory
    rpActiveSubCategory
    rpActiveSpecs
    rpActiveSubCategory is populated inside of rpActiveCategory's OnItemDataBound

    rpActiveSpecs populating needs to be done from a sub that can be called where
    needed as this holds the records, so on updates i need to re-populate it.

    problem is i'm struggeling to reference controls inside of rpActiveSpecs in
    the sub, I can reference them from rpActiveSubCategory's OnItemDataBound but that doesn't help me

    here's my sub to populate rpActiveSpecs: (check bits in red)
    Code:
    Public Sub Populate_rpActiveSpecs(ByVal myParams As Params)
    ActiveSpecsPagedData.DataSource = SpecsManager.GetList(myParams)
    If myParams.ActivatedPage = 0 Then
    myParams.ActivatedPage = 0
    ActiveSpecsPagedData.CurrentPageIndex = 0
    Else
    ActiveSpecsPagedData.CurrentPageIndex = myParams.ActivatedPage
    End If

    'set datasource parameters
    ActiveSpecsPagedData.AllowPaging = True
    ActiveSpecsPagedData.PageSize = 25

    myParams.PageCount = ActiveSpecsPagedData.PageCount
    'btnPrev.Text = "<"
    'btnPrev.Visible = (Not ActiveSpecsPagedData.IsFirstPage)

    'btnNext.Text = ">"
    'btnNext.Visible = (Not ActiveSpecsPagedData.IsLastPage)

    'lblActivePagingPages.Text = "Page " & ActiveSpecsPagedData.CurrentPageIndex + 1 & " of " & ActiveSpecsPagedData.PageCount
    'lblActivePagingPages.CssClass = "PageNumbers"

    'for paging
    If ActiveSpecsPagedData.PageCount = 0 Then
    'lblActivePagingPages.Visible = False
    'btnNext.Visible = False
    'btnPrev.Visible = False
    Else
    'lblActivePagingPages.Visible = True
    End If

    'for sorting
    Dim lbtnActiveRoomNo As LinkButton = FindControl("lbtnActiveRoomNo")
    Dim lbtnActiveSpecNo As LinkButton = FindControl("lbtnActiveSpecNo")
    Dim lbtnActiveQty As LinkButton = FindControl("lbtnActiveQty")
    Dim lbtnActiveUnit As LinkButton = FindControl("lbtnActiveUnit")
    Dim lbtnActiveDescription As LinkButton = FindControl("lbtnActiveDescription")
    If ActiveSpecsPagedData.Count <= 1 Then
    lbtnActiveRoomNo.Enabled = False
    lbtnActiveSpecNo.Enabled = False
    lbtnActiveQty.Enabled = False
    lbtnActiveUnit.Enabled = False
    lbtnActiveDescription.Enabled = False
    Else
    lbtnActiveRoomNo.Enabled = True
    lbtnActiveSpecNo.Enabled = True
    lbtnActiveQty.Enabled = True
    lbtnActiveUnit.Enabled = True
    lbtnActiveDescription.Enabled = True
    End If


    'only bind data if there is data
    If ActiveSpecsPagedData.PageCount > 0 Then
    Dim rpActiveSpecs As Repeater = FindControl("rpActiveSpecs")
    rpActiveSpecs.DataSource = ActiveSpecsPagedData
    rpActiveSpecs.DataBind()
    End If
    End Sub
    any ideas or workarounds?
    Shem
View as RSS news feed in XML