·您的位置: 首页 » 资源教程 » 编程开发 » ASP.NET » 鼠标移动,改变datagrid颜色

鼠标移动,改变datagrid颜色

类别: ASP.NET教程  评论数:0 总得分:0
Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

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

\'---------------------------------------------------
\' Add the OnMouseOver and OnMouseOut method to the Row of DataGrid
\'---------------------------------------------------
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor=\'Silver\'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=\'white\'")

End If

End Sub

Sub DataGrid2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

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

\'---------------------------------------------------
\' Add the OnMouseOver and OnMouseOut method a Cell (Column) of DataGrid
\'---------------------------------------------------
e.Item.Cells(1).Attributes.Add("onmouseover", "this.style.backgroundColor=\'#DDEEFF\'")
e.Item.Cells(1).Attributes.Add("onmouseout", "this.style.backgroundColor=\'white\'")

\'---------------------------------------------------
\' Change the Mouse Cursor of a particular Cell (Column) of DataGrid
\' (Or you may do it for a whole Row of DataGrid :)
\'---------------------------------------------------
e.Item.Cells(3).Style("cursor") = "hand"

\'---------------------------------------------------
\' Add the OnClick Alert MessageBox to a particular Cell (Column) of DataGrid
\'---------------------------------------------------
e.Item.Cells(3).Attributes.Add("onclick", "alert(\'You click at ID: " & e.Item.Cells(0).Text & "!\');")

End If
End Sub




-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1