I have a databound repeater that I am using to display a report. This
repeater has an onItemDataBound event handler that counts the number of rows
that have been output, and inserts a new row every 7th -- a repeating
header.
This works with one unwanted side effect that I hope someone can explain to
me how to get around.
This is the flow:
'THIS IS THE ONITEMDATABOUND EVENT HANDLER
Public Sub checkHeader(ByVal sender As System.Object, ByVal e As
RepeaterItemEventArgs)
If ((e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem) _
And mvarrepeatHeader) Then
numOfRows += 1
If numOfRows Mod mvarrepeatNum = 0 Then
insertHeader(e.Item.ItemIndex)
End If
End If
End Sub
'THIS IS THE INSERTHEADER SUB THAT'S CALLED FROM THE EVENT HANDLER
Private Sub insertHeader(ByVal index As Integer)
Dim repeatHeader As New TableRow()
repeatHeader = returnHeader()
rptReport.Controls.AddAt(index, repeatHeader)
End Sub
The side effect is that the eventHandler is not called enough times to get
all of the lines inserted until the end of my list. i.e. what I think is
happening is that because I'm adding those controls in, then the event stops
firing pre-maturely, leaving the lower portion of my repeater void of the
repeating headers. The longer the list, the more is left void -- and vice
versa.
Can someone explain this to me, and how would I go about getting it to work
like I want?
Thanks!
Paul Prewett
repeater has an onItemDataBound event handler that counts the number of rows
that have been output, and inserts a new row every 7th -- a repeating
header.
This works with one unwanted side effect that I hope someone can explain to
me how to get around.
This is the flow:
'THIS IS THE ONITEMDATABOUND EVENT HANDLER
Public Sub checkHeader(ByVal sender As System.Object, ByVal e As
RepeaterItemEventArgs)
If ((e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem) _
And mvarrepeatHeader) Then
numOfRows += 1
If numOfRows Mod mvarrepeatNum = 0 Then
insertHeader(e.Item.ItemIndex)
End If
End If
End Sub
'THIS IS THE INSERTHEADER SUB THAT'S CALLED FROM THE EVENT HANDLER
Private Sub insertHeader(ByVal index As Integer)
Dim repeatHeader As New TableRow()
repeatHeader = returnHeader()
rptReport.Controls.AddAt(index, repeatHeader)
End Sub
The side effect is that the eventHandler is not called enough times to get
all of the lines inserted until the end of my list. i.e. what I think is
happening is that because I'm adding those controls in, then the event stops
firing pre-maturely, leaving the lower portion of my repeater void of the
repeating headers. The longer the list, the more is left void -- and vice
versa.
Can someone explain this to me, and how would I go about getting it to work
like I want?
Thanks!
Paul Prewett