Avoiding empty cells in a DataList

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
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.
 
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
 
Back
Top