By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,686 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,686 IT Pros & Developers. It's quick & easy.

Can you get the record count inside a repeater control?

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.