/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Codebehind protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "MouseOn(this)"); e.Row.Style["cursor"] = "pointer;hand;"; e.Row.Attributes.Add("onmouseout", "MouseOff(this)"); e.Row.Attributes.Add("onclick", "window.location=\'ViewDetailRecord.aspx?ItemId=" + e.Row.Cells[0].Text + "\'"); } } //Page HTML <script type="text/javascript" language="javascript"> var holding = "white"; function MouseOn(elem) { holding = elem.style.backgroundColor; elem.style.backgroundColor = "#f2f2f2"; //alert(elem.style.backgroundColor); } function MouseOff(elem) { //alert(holding); elem.style.backgroundColor = holding; } </script>