在RowDataBound事件中编写下列代码
protected void GridView_RowDataBound(object sender,GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControRowType.DataRow)判断是否为数据行判断是否为数据行
{
//添加两个事件 设置当前行的移动效果
e.row.Attributes.add("onmouseover","currentColor=this.style.backgroundColor;this.style.backgroundColor='green'");
e.row.Attributes.add("onmouseout","this.style.backgroundColor=currentColor");
}
}
今天 顺便巩固一下!