Perhaps e.Item.ItemIndex (+1)
Example:
--ASPX:
<asp:Repeater ID="rpt" runat="server">
<ItemTemplate>
something<br />
<asp:Literal ID="lit" runat="server" Visible="false"><div>Put your page
break div here.</div></asp:Literal>
</ItemTemplate>
</asp:Repeater>
--VB:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
''Just some bogus data for demo purposes:
Dim dt As New DataTable()
dt.Columns.Add("ID", Type.GetType("System.Int32"))
dt.Columns.Add("Text", Type.GetType("System.String"))
Dim q As Integer
For q = 1 To 100
Dim r As DataRow = dt.NewRow()
r("ID") = q
r("Text") = "Item #" & CStr(q)
dt.Rows.Add(r)
Next
rpt.DataSource = dt
rpt.DataBind()
End Sub
Protected Sub rpt_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rpt.ItemDataBound
If (e.Item.ItemIndex + 1) Mod 6 = 0 Then
CType(e.Item.FindControl("lit"), Literal).Visible = True
End If
End Sub
---------------------------------------------------
Ray at work
"RC-" <r_******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi everyone,
I have been searching and searching for an answer to this question using
Google and what not; I have not been able to find a "clear cut" answer.
OK, now the question:
I have a Repeater control that works great. What I am trying to do is
perform an active count of the number of rows that the repeater is
rendering. The end goal is to insert a page break after six rows of data.
I cannot figure out how to count the rows one by one using ASP.NET (ASP is
easy).
Any help will be greatly appreciated.
TIA,
RC-