(1). Example Image
(2 ).Code
[Front-end]
< Script Language = " Javascript " >
Function dbclickevent (d)
{
Window. Alert ( " Event Type: doubleclidk action object: " + D );
}
Function clickevent (d)
{
Window. Alert ( " Event Type: onclick action object: " + D );
}
Function gridviewitemkeydownevent (d)
{
Window. Alert ( " Event Type: gridviewitemkeydownevent: " + D );
}
Function keydownevent ()
{
If ( Event . Altkey && Event . Keycode > 48 && Event . Keycode < 54 )
{
Window. Alert ( " Event Type: formkeydownevent selected records: " + (Parseint ( Event . Keycode) - 48 ));
}
}
</ Script >
[Background]
If (E. Row. rowtype = Datacontrolrowtype. datarow)
{
// The effect of alternating colors when the mouse moves to each item
E. Row. Attributes. Add ( " Onmouseout " , " This. style. backgroundcolor = 'white'; this. style. Color = '#003399' " );
E. Row. Attributes. Add ( " Onmouseover " , " This. style. backgroundcolor = '# 6699ff'; this. style. Color = '#8c4510' " );
// Click/double-click event
E. Row. Attributes. Add ("ondblclick", "dbclickevent ('" + E. Row. cells [1]. Text + "')");
E. Row. Attributes. Add ( " Onclick " , " Clickevent (' " + E. Row. cells [ 1 ]. Text + " ') " );
E. Row. Attributes. Add ("onkeydown", "gridviewitemkeydownevent ('" + E. Row. cells [1]. Text + "')");
//Set the floating mouse pointer to "little hand"
E. Row. attributes ["Style"]= "Cursor: Hand";
}
* There are more and more events. You can use similar methods to complete more complex and better-performing pages.
(3) Download Sample Code
Http://files.cnblogs.com/ChengKing/Gridview (dbclick000020onmouseover000020etc0000.rar