Problem with setting background color alternating item in datalist to a certain color

Discussion in 'ASP .Net Web Controls' started by fig000, Sep 6, 2004.

  1. fig000

    fig000 Guest

    Hi,

    I have a datalist and I'm using the following code in the
    itemdatabound event to change the color to red on alternating items:

    If e.Item.ItemType = ListItemType.AlternatingItem Then
    e.Item.BackColor = System.Drawing.Color.Red
    End If

    I've used this before and it's worked but I must be doing
    something odd this time. What I see when the page is rendered is a
    little red line below the first item in my itemtemplate which happens
    to be an asp image control. All of the elements of the line appear but
    there is no red except for this one little line. In addition, rather
    than it appearing on the alternating item (2,4,6, etc) it appears on
    the odd numbered items (1,3, etc).

    Any help would be appreciated.

    Neil
    fig000, Sep 6, 2004
    #1
    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. Nevyn Twyll
    Replies:
    8
    Views:
    1,864
  2. Eirik Eldorsen
    Replies:
    1
    Views:
    606
    Eliyahu Goldin
    Nov 21, 2004
  3. Replies:
    2
    Views:
    3,338
  4. M. Craig
    Replies:
    1
    Views:
    743
    Victor Garcia Aprea [MVP]
    Jan 9, 2004
  5. Newton

    Alternating table background colors

    Newton, Jun 12, 2004, in forum: ASP General
    Replies:
    1
    Views:
    138
    Roji. P. Thomas
    Jun 12, 2004
Loading...

Share This Page