Avoiding empty cells in a DataList

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    #1

    Avoiding empty cells in a DataList

    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 AlternatingItem Template 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.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。



  • Eliyahu Goldin

    #2
    Re: Avoiding empty cells in a DataList

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

    Eliyahu

    "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
    news:%23L7GQwuv FHA.3452@TK2MSF TNGP14.phx.gbl. ..[color=blue]
    > 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[/color]
    cells[color=blue]
    > 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 AlternatingItem Template with a different BackColor property
    > than my ItemTemplate. However, depending on the number of items my[/color]
    DataList[color=blue]
    > 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[/color]
    item[color=blue]
    > using the ItemDataBound event. Thanks.
    > --
    > Nathan Sokalski
    > njsokalski@hotm ail.com
    > http://www.nathansokalski.com/
    >
    >[/color]


    Comment

    Working...