Can you get the record count inside a repeater control?

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
 
D

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top