title: .Net Gridview restoring alternating color after mouseover
body: <p>I have a gridview with the alternatingRowStyle property set.</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
          DataSourceID="SqlDataSource2" OnRowDataBound="GridView1_RowDataBound"
          onselectedindexchanged="GridView1_SelectedIndexChanged" AlternatingRowStyle-BackColor="#f0f1f3"&gt;
  </code></pre>
  
  <p>I also want to highlight rows as the cursor moves over with this:</p>
  
  <pre><code>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)  
  {  
          if (e.Row.RowType == DataControlRowType.DataRow)  
          {  
              e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ceedfc'");  
              e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");  
              e.Row.Attributes.Add("style", "cursor:pointer;");
  </code></pre>
  
  <p>The problem I'm having is that when the mouse moves past the row, it is being restored to white, not the previous color, which is different in half the rows.  I supposed I could save the current rowcolor before replacing it for each "onmouseove" event, but that seems expensive and worrisome if fast mouse movement could mess things up. </p>
  
  <p>I don't see a property for gridview rows to tell me if it is alternate row but would a simple odd/even determination on the rowindex be best here?</p>
  
  <p>Any better suggestions?</p>
  
  <p>Thanks.</p>
  
  <p>-Dan</p>