/ Published in: C#
Expand |
Embed | Plain Text
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e) { DataControlRowType rtype = e.Row.RowType; if (rtype == DataControlRowType.DataRow && rtype != DataControlRowType.Footer && rtype != DataControlRowType.Separator && rtype != DataControlRowType.Header && rtype != DataControlRowType.Pager) { e.Row.Attributes.Add("onmouseover", "Highlight(this,'#DCEDFF');"); e.Row.Attributes.Add("onmouseout", "resetColorRows('#ffffff','#eeeeee');"); } } <script type="text/javascript"> function Highlight(row,color) { row.style.backgroundColor=color; } function resetColorRows(color1,color2) { var bgColor; t = document.getElementsByTagName("tr"); for (var i=1; i<t.length; i++) { if ((i % 2) == 1) bgColor = color1; else bgColor = color2; t[i].style.backgroundColor = bgColor; } } </script>
You need to login to post a comment.
