一: 新建一个数据源.
二:托动一个GridView到页面
三:选中GridView,设置事件
四:双击GridView1_RowCreated,编写代码:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)//也可以用GridView1_RowDataBound效果是一样的
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='00ffee';");//设置属性,修改背景颜色.在这儿你可以修改其它的属性,如利用css我是个菜鸟,刚开始学,不会
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}
}