Function Description:
In the gridview, when the mouse moves in the data list of this control, the background of this column changes the background color as the mouse moves.
Function implementation:
Add an event rowdatabound in the gridview, Code As follows:
Copy code The Code is as follows: protected void gvwnews_rowdatabound (Object sender, gridviewroweventargs E)
{
If (E. Row. rowtype = datacontrolrowtype. datarow)
{
E. Row. Attributes. Add ("onmouseover", "color = This. style. backgroundcolor; this. style. backgroundcolor = '# eafcd5 '");
E. Row. Attributes. Add ("onmouseout", "This. style. backgroundcolor = color ");
E. Row. Attributes. Add ("onclick", "clickrow ()");
}
}
The onclick event controls the check box at the beginning of a row. Click the row to achieve the same effect as the "click" check box. The Code is as follows:Copy codeThe Code is as follows: function clickrow ()
{
VaR OBJ = event. srcelement. parentelement. firstchild. firstchild. tagname;
Alert (OBJ );
If (OBJ! = NULL & obj. tagname + ""! = "Undefined ")
{
OBJ. Checked = obj. checked? False: true;
}
}
A few simple lines of code are required.