aList1_ItemDataBound()Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound
i = i + 1
If i > 3 And i <= 6 Then
e.Item.BackColor = Color.Blue
End If
If i >= 6 Then
i = 0
End If
End Sub
End Class
在补充一下,这里的i>3 and i<=6这个,我刚才没讲清楚,可能您有点困惑呢!
因为我这里是每行显示三条数据啦.所以这里是3和6,如果您是5条的话,那么就是5和10了,以此类推!