Use the following two steps to solve this case. This will applicable for both Gridview and Datagrid controls.
Step 1 : Create styles for normal and highlight view of the row.
Step 2 : Now add handler for
<style type="text/css">
.normalrow
{
background-color:white;
}
.hightlighrow
{
background-color:#cccccc;
}
</style>
RowCreated
event for the grid and add the attributes for onmouseover
and onmouseout
javascript events.Following code snippet shows how this has been done.
Use the technology!!!
protected void OnRowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.className='hightlighrow'");
e.Row.Attributes.Add("onmouseout", "this.className='normalrow'");
}
}