直接在GridView裡的RowDataBound事件加入以下的程式碼即可

        If e.Row.RowType = DataControlRowType.DataRow Then
            '滑鼠移至資料列上的顏色
            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='D6FFAF'")
            '滑鼠離開資料列上的顏色
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'")
        End If

 

顏色可由色碼表來做更換

文章標籤
全站熱搜
創作者介紹
創作者 kingjoy1235 的頭像
kingjoy1235

King的幸福國度

kingjoy1235 發表在 痞客邦 留言(0) 人氣(149)