Datalist with more than one column

F

Frank

Hi all,

I'm having this challenge:
I have a datalist, which I display in more than one column
(RepeatColumns="3") and RepeatDirection is horizontal. At the same time I
want to display an alternate background color on the every second item.

However, the number of items in the list is not always the same, and since
..NET seems to pick (for himself) what number of items to display in each
column, I can't control how it's going to come out in the browser.

To better illustrate (with the ItemTemplate's backgroundcolor as Gray, and
the AlternatingItemTemplate's backgroundcolor as Silver:

1. A list with 9 elements would display like this:

Gray Gray Gray
Silver Silver Silver
Gray Gray Gray

2. However, a list with 10 element would display like this:

Gray Gray Silver
Silver Silver Gray
Gray Gray Silver
Gray

What I'm asking is: is it possible to detect when the datalist is actually
starting a new column, so I can override or something? Or is there a better
way to fix this?

Any help or assistance is much appreciated. Thanks!
 
R

Robert Koritnik

I think the best way would be to make your own event handler for
OnItemDataBound event and create TRs & TDs as needed...
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top