北极·新秀
非注明原著,皆源之网络。
posts - 118,comments - 64,trackbacks - 5

在gridview 中,经常会需要一种这样的效果,当鼠标放在某一行时,某一行有一个CSS效果,当鼠标移开该行时,又有另外一个效果,这其实就是利用了onmouseover的效果,实现起来其实很简单,在gridview的
row_databound事件中这样实现就可以了
   protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)

{

e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='blue'");

e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");

}

}

posted on 2006-03-22 11:18 北极熊,我来了! 阅读(769) 评论(1) 编辑 收藏