Thursday, May 29, 2008

AlternatingItem Property in DataGrid

If you like to use AlternatingRowStyle property like Gridview has inside DataGrid, thats how you use it:

Protected Sub HG1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles HG1.ItemDataBound

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

End Sub

No comments: