Published in: C#
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 sBgColor; t = document.getElementsByTagName("tr"); for (var i=1; i<t.length; i++){ if ((i % 2) == 1) { sBgColor = color1; } else { sBgColor = color2; } t[i].style.backgroundColor = sBgColor; } } </script>
You need to login to post a comment.
