6月 13, 2011

asp.net 光棒


Protected Sub GridView1_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated

If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='red';")
If e.Row.RowState = DataControlRowState.Alternate Then '判定row的型態是替代資料行
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF';")
'滑鼠移開底色恢復
Else
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#EFF3FB';")
'滑鼠移開底色恢復
End If
End If
End Sub

沒有留言: