<asp:datagrid >  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            Dim d As New Data
            DataGrid1.DataSource = d.getTable
            DataGrid1.DataBind()

        End If
        If Not Request.Form("hidden1") Is Nothing Then
            TextBox1.Text = Request.Form("hidden1").ToString
        End If
    End Sub

    Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
        If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then
            'Response.Write(Color.Beige.ToString())
            'e.Item.Attributes("id") = e.Item.ItemType.ToString() e.Item.ItemIndex.ToString()
            e.Item.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#FFF7E7';this.style.color='#8C4510'")
            e.Item.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#A55129';this.style.color='white';this.style.cursor='hand';")
            e.Item.Attributes.Add("Ondblclick", "javascript:setv(" e.Item.Cells(0).Text ")")
        End If
    End Sub
End Class

相关文章: