Mouse movement, change the DataGrid color (reproduced)

xiaoxiao2021-03-06  105

Sub DataGrid1_ItemDatabase (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 rotory

'------------------------------------- -

E.Item.attributes.add ("onmouseover", "this.style.backgroundcolor =

'Silver' ")

E.Item.attributes.add ("onmouseout", "this.style.backgroundcolor =

'White' ")

END IF

End Sub

Sub DataGrid2_ItemDatabase (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.backcolor =

'White' ")

'------------------------------------- -

'Change The Mouse Cursor of a Particular Cell (Column) of DataGrid

'(Or you may do it for a whole row of data ")

'------------------------------------- -

E.Item.cells (3) .style ("cursoor") = "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

转载请注明原文地址:https://www.9cbs.com/read-123707.html

New Post(0)