鼠标移动,改变DataGrid颜色
2004-10-24 22:45
447 查看
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
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
相关文章推荐
- 当鼠标移动时,改变datagrid中的颜色
- 鼠标移动,改变datagrid颜色 (转载)
- 鼠标移动,改变datagrid颜色
- 鼠标移动,改变DataGrid颜色
- 鼠标移动 改变Datagrid行的背景颜色
- 鼠标移动,改变datagrid颜色
- WPF 设置DataGrid 鼠标移动改变行颜色样式
- 设置WPF DataGrid 鼠标移动改变行颜色样式
- WPF 设置DataGrid 鼠标移动改变行颜色样式
- DataGrid中鼠标点击、移动后行颜色改变效果
- datagrid每一行都会随着鼠标的动作改变颜色
- Asp.NET(c#)DataGrid鼠标悬停项改变颜色,移除恢复
- datagrid 移动鼠标时背景色改变
- datagrid每一行都会随着鼠标的动作改变颜色
- JS实现页面table鼠标移动改变tr行颜色,单击tr选中复选框功能
- 当鼠标移动到GridView控件上某行时,该行的颜色改变(GridView行变色)
- DataGrid中加多选按钮 和 鼠标移动显示不同的颜色
- 在Web DataGrid 中当鼠标移到某行与离开时行的颜色发生改变(结合javascript)
- 网站导航标题栏下面有一小色块跟随鼠标移动,同时色块颜色改变的特效
- 当鼠标移动到表格的一行时这一行的背景颜色发生改变