Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemCreated

        'Note, there must be a hidden Select button in column 0 of the Datagrid for this to work properly....

        'When this code "executes", it will kick off the DataGrid1_SelectedIndexChanged Event and could also be

        'caption in the DataGrid1_ItemCommand event e.CommandName = "Select"

        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.SelectedItem Then

 

            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='beige';this.style.cursor='hand';this.style.cursor = 'hand'")

            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white';")

            ' why plus 2??... we need to specify the data row, (base 1), so the header is row 1 and the first data row is

            'row 2. e.item.itemindex starts as base 0, so 0 + 2 = 2... the first data row!

            e.Item.Attributes.Add("onclick", "javascript:__doPostBack('" & "DataGrid1:" & "_ctl" & e.Item.ItemIndex + 2 & ":_ctl0','')")

        End If

    End Sub