快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

鼠标移动,改变datagrid颜色

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





返回类别: 教程
上一教程: 用.NET创建Windows服务
下一教程: 第十三章 枚举类型与位标记[《.net框架程序设计》读书笔记]

您可以阅读与"鼠标移动,改变datagrid颜色"相关的教程:
· DataGrid在分页状态下删除纪录的问题
· 给上次的DataGrid分页增加些功能!
· DataGrid脚眉显示合计
· DataGrid巧用实现目录浏览
· 创建完全可编辑的 DataGrid
    微笑服务 优质保证 索取样品