Avoiding empty cells in a DataList

Discussion in 'ASP .Net Datagrid Control' started by Nathan Sokalski, Sep 21, 2005.

  1. 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.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    Nathan Sokalski, Sep 21, 2005
    #1
    1. Advertising

  2. 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

    "Nathan Sokalski" <> wrote in message
    news:%...
    > 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.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    >
    Eliyahu Goldin, Sep 22, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski

    Avoiding empty cells in a DataList

    Nathan Sokalski, Sep 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    515
    Eliyahu Goldin
    Sep 22, 2005
  2. Replies:
    0
    Views:
    526
  3. Savvoulidis Iordanis

    Empty gridview cells and checking for empty string

    Savvoulidis Iordanis, Sep 5, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    520
    Savvoulidis Iordanis
    Sep 5, 2008
  4. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    306
    Joel Finkel
    Sep 1, 2003
  5. Nathan Sokalski

    Avoiding empty cells in a DataList

    Nathan Sokalski, Sep 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    144
    Eliyahu Goldin
    Sep 22, 2005
Loading...

Share This Page