if(e.Item.ItemType = ListItemType.Item)
{
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#FF5500'")
        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='黑色'")}
if(e.Item.ItemType = ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#FF5500'")
        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='白色'")}
分别设置就可以了,我是C#,VB类似的!

解决方案 »

  1.   

    将ListItemType.Item和ListItemType.AlternatingItem分别使用不同的样式属性:如:
            If e.Item.ItemType = ListItemType.Item Then
            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#FF5500'")
            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'")
            Else If e.Item.ItemType = ListItemType.AlternatingItem 
            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#FF5500'")
            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#AAAAAA'")
            End If
      

  2.   

    将ListItemType.Item和ListItemType.AlternatingItem分别使用不同的样式属性:如:
            If e.Item.ItemType = ListItemType.Item Then
            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#FF5500'")
            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'")
            Else If e.Item.ItemType = ListItemType.AlternatingItem 
            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#FF5500'")
            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#AAAAAA'")
            End If