getting rowcount from within a repeater control

  • Thread starter Thread starter Darrel
  • Start date Start date
D

Darrel

I'm working on an asp.net 1.1 app and trying to put as much output as I can
into repeater controls to let the client later modify the HTML.

I'm stuck on how to add the rowcount to a repeater. I have a need to put the
item # in the HTML (ie, row 0 needs to output a 0 to the HTML, row 1 needs
to putput a 1, etc.)

Is there a way to get the rowcount of the data from within the control?
Something like DataBinder.Eval.GetRowCount (which I know does not exis). Or
should this be handled via the SQL query itself and create a field in the
dataset? Another method?

-D
 
Hi Darrel,
try using Container.ItemIndex, see example below.

<asp:Repeater ID="testRepeater" runat="server">
<ItemTemplate>
<asp:Label ID="name" Text='<%# Eval("Name") %>'
runat="server" /><br>
<asp:Label ID="itemIndex" Text='<%# Container.ItemIndex %>'
runat="server" /><br>
</ItemTemplate>
</asp:Repeater>

Cheers
SteveS
 
Back
Top