Avoiding empty cells in a DataList

N

Nathan Sokalski

I have a DataList with a RepeatColumns property that has a value of 3.
However, when the number of items is not divisible by 3, I have blank cells
at the end of the list, which makes the DataList look somewhat ugly. Is
there a way to avoid this? Thanks.

I also use an AlternatingItemTemplate with a different BackColor property
than my ItemTemplate. However, depending on the number of items my DataList
might end up looking like a checkerboard if the first itemtype in each
column is different. Is there some way to "reset" the itemtype for each
column? I would rather not need to set the BackColor manually for each item
using the ItemDataBound event. Thanks.
 
E

Eliyahu Goldin

Don't use AlternatingItemTemplate. Rather use PreRender event to loop
through the items and set their BackColor depending on the item position in
the row.

Eliyahu
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top