GridView : OnMouseOver, OnMouseOut

aspx.vb -- GridView_RowDataBound

Protected Sub gv_Series_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_Series.RowDataBound
  If (e.Row.RowType = DataControlRowType.DataRow) Then
    e.Row.Attributes.Add("OnMouseOver", "javascript:setMouseOverColor(this);")
    e.Row.Attributes.Add("OnMouseOut", "javascript:setMouseOutColor(this);")
  End If
End Sub


aspx -- JavaScript

var oldgridSelectedColor;

function setMouseOverColor(element) {
  oldgridSelectedColor = element.style.backgroundColor;
  element.style.backgroundColor = 'yellow';
}

function setMouseOutColor(element) {
  element.style.backgroundColor = oldgridSelectedColor;
}

Comments

Popular posts from this blog

การตั้งเวลาระหว่าง Server และ Client

วิธีตั้งค่า NTP บน Primary Domain Controller

Installation and Run Node.JS on IIS