标签:style color ar 数据 div sp art on c
一、 首先在前台GridView中加上onrowdatabound="GridView1_RowDataBound":
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
onrowdatabound="GridView1_RowDataBound">
.......
</asp:GridView>
二、然后在后台的GridView1_RowDataBound事件中写
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor=‘#99FFCC‘"); //鼠标悬停变色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); //鼠标移走颜色还原
}
}
标签:style color ar 数据 div sp art on c
原文地址:http://www.cnblogs.com/gcczhongduan/p/3989097.html