Can you get the record count inside a repeater control?

  • Thread starter Thread starter darrel
  • Start date Start date
D

darrel

I'm trying to whip up a fancy repeater control that will put records into a
two-column table for me.

This is how I envision it working:

itemtemplate
if record count = odd then write out the TR tag
td <record> /td
if record count = even then wrote out the /TR tag
if record count = odd AND it's the last record, write out an empty TD and
/TR tag
/itemtempalte

That logic isn't perfect ,but hopefully that got the point across.

The first record, being odd, opend the TR and writes out a TD. The second
record, being even, writes out a TD, and then then closed the TR. Etc.

I then need to check the last record. If it is odd, it needs to pad one
extra TD before closing the TR so the table is valid.

So...the question! Can you grab the record count from within the UserControl
itself?

-Darrel
 
Or, perhaps a different question to get the same result...

Can I call two consecutive records in the same itemTemplate? Ie, something
like this:

<ItemTemplate>
<# DataBinder.Eval(Container.DataItem, "ContactID")%>
<# some useful function to advance to the next record ;o) %>
<# DataBinder.Eval(Container.DataItem, "ContactID")%>
</ItemTemplate>

-Darrel
 
Back
Top