悬赏分:20 浏览:422 次
当鼠标放在GridView的某一行时变色,离开是是有变色,好象在DataBinding事件中写什么...
请大哥们举个简单的例子!先谢谢!
|
在模板中加 onmouseover =“”
onmouseleave=“” 在事件中指定每一行的onmouseover onmouseout事件,在事件中通过js代码改变颜色 如: e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#D1E9F1'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor"); GridView1_RowDataBound事件中写入楼上的代码就可以了. 三楼正解 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Attributes.Add("onmouseover", "this.style.cursor='hand';this.originalcolor=this.style.backgroundColor; this.style.backgroundColor='Silver';"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalcolor;"); } |
|
3个月前 HamunNet : GridView中什么地方? 我是个新新手,对GridView还不熟悉!我还是不懂 麻烦您啊! |