HTML:
<script type="text/javascript">
var oldrow=null;
var currentcolor=null;
var oldcolor=null;
function selectx(row)
{
if(oldrow!=null)
{
oldrow.style.backgroundColor=oldcolor;
}
row.style.backgroundColor='#99ccff';
oldrow=row;
oldcolor = currentcolor;
}
</script>
.cs:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "if(this!=oldrow){currentcolor=this.style.backgroundColor;this.style.backgroundColor='PeachPuff',this.style.fontWeight='';}");
e.Row.Attributes.Add("onmouseout", "if(this!=oldrow){this.style.backgroundColor=currentcolor;this.style.fontWeight='';}");
e.Row.Attributes.Add("onclick", e.Row.ClientID.ToString() + ".checked=true;selectx(this)");
}
}