protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//for (int i = 0; i < GridView1.Rows.Count; i++)
//{
if (e.Row.RowType==DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
//}
if (e.Row.RowIndex != -1)
{
int id = e.Row.RowIndex + 1;
e.Row.Cells[0].Text = id.ToString();
}
}
GridView实现自动编号及鼠标移到GridView某一行时改变该行的背景色
最新推荐文章于 2022-02-25 19:38:17 发布