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;
}
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
Post a Comment