Several events of the GridView (for example, double-click the row, click/capture the keyboard buttons, hover the mouse, and remove the row) (sample code download)
(1). Example Image
(2). Code
[Front-end]
<Script language = "javascript">
Function DbClickEvent (d)
{
Window. alert ("Event Type: DoubleClidk:" + d );
}
Function ClickEvent (d)
{
Window. alert ("Event Type: OnClick 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 the 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 "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.