title: How to color the first row in a asp:grid
body: <p>Good Morning/Afternoon all, </p>
  
  <p>I have a ASP:grid which displays current versions of Terms and Condition that we have currently used/using the first row in the grid is always the one we are currently using and i need to highlight that row but im having trouble trying to highlight it</p>
  
  <p>Heres the asp:gridview</p>
  
  <p><code></p>
  
  <pre><code>&lt;asp:GridView runat="server" ID="grvTermsAndConditions" AutoGenerateColumns="false"
                      OnRowDataBound="grvTermsAndConditions_rowDataBound" Style="margin-bottom: 20px;"&gt;
                      &lt;Columns&gt;
                          &lt;asp:TemplateField HeaderText="CurrentVersion"&gt;
                              &lt;ItemTemplate&gt;
                                  &lt;asp:Label ID="lblVersion" CssClass="gvItem" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.CurrentVersion") %&gt;'&gt;&lt;/asp:Label&gt;
                              &lt;/ItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                          &lt;asp:TemplateField HeaderText="Added"&gt;
                              &lt;ItemTemplate&gt;
                                  &lt;asp:Label ID="lblDateAdded" CssClass="gvItem" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.Added") %&gt;'&gt;&lt;/asp:Label&gt;
                              &lt;/ItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                          &lt;asp:TemplateField HeaderText="CreatedBy"&gt;
                              &lt;ItemTemplate&gt;
                                  &lt;asp:Label ID="lblCreatedBy" CssClass="gvItem" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.CreatedBy") %&gt;'&gt;&lt;/asp:Label&gt;
                              &lt;/ItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                      &lt;/Columns&gt;
                  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p></code></p>
  
  <p>This is my code behind where im trying to get the first row and color is red</p>
  
  <p><code></p>
  
  <pre><code>protected void grvTermsAndConditions_rowDataBound(Object sender, GridViewRowEventArgs e)
          {
  
              for (int i = 0; i &lt; grvTermsAndConditions.Rows.Count; ++i )
              {
                  if (i == 0)
                  {
                      e.Row.CssClass = "gvRowRed";
                      e.Row.Cells[0].CssClass = "white";
                      e.Row.Cells[1].CssClass = "white";
  
                  }
              }
          }
  </code></pre>
  
  <p></code></p>
  
  <p>But every time i run this the second row gets coloured?!?!</p>
  
  <p>Any help would be appreciated.</p>