title: Change gridview's row color ASP.NET
body: <p>I have this gridview that shows two tables together (with merge method). I want to change the row's color of the row 0 and the row 11. I know that I can do it with the row data bound event but I don't know how to choose the rows on runtime. <img src="https://i.stack.imgur.com/9G58t.png" alt="enter image description here"></p>
  
  <p>My code-behind.</p>
  
  <pre><code>public void mergetbl(DataTable DocVisTbl, DataTable cobtable)
  {
  
      DataTable mergetable = DocVisTbl.Copy();
      mergetable.Merge(cobtable);
  
      DataRow row;
      row = mergetable.NewRow();
      row["Stakeholder"] = "Número de Médicos";
      mergetable.Rows.InsertAt(row, 0);
      row = mergetable.NewRow();
      row["Stakeholder"] = "Médicos Visitados";
      mergetable.Rows.InsertAt(row, 11);
  
  
      DataTable mergetable_Clone = mergetable.Clone(); //just copy structure, no data
  
      for (int i = 0; i &lt; mergetable_Clone.Columns.Count; i++)
      {
          if (mergetable_Clone.Columns[i].DataType != typeof(string))
              mergetable_Clone.Columns[i].DataType = typeof(string);
      }
  
      foreach (DataRow datarow in mergetable.Rows)
      {
          mergetable_Clone.ImportRow(datarow);
  
      }
  
      for (int x = 1; x &lt; mergetable_Clone.Columns.Count; x++)
      {
          mergetable_Clone.Rows[4][x] = mergetable_Clone.Rows[4][x] + "%";
          mergetable_Clone.Rows[7][x] = mergetable_Clone.Rows[7][x] + "%";
          mergetable_Clone.Rows[10][x] = mergetable_Clone.Rows[10][x] + "%";
          mergetable_Clone.Rows[15][x] = mergetable_Clone.Rows[15][x] + "%";
          mergetable_Clone.Rows[18][x] = mergetable_Clone.Rows[18][x] + "%";
          mergetable_Clone.Rows[21][x] = mergetable_Clone.Rows[21][x] + "%";
  
      }
      MergeGrid.DataSource = mergetable_Clone;
      MergeGrid.DataBind();        
  }
  
  protected void MergeGrid_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      //if (e.Row.RowType == DataControlRowType.DataRow)
      //{
      //
      //}
  }
  </code></pre>
  
  <p>My CSS code</p>
  
  <pre><code> .Grid {   
      width: auto; 
      background-color: #fff;   
      margin: 5px 0 10px 0;   
      border: solid 2px #525252;   
      border-collapse:collapse;   }  
  
  /*Gridview table data*/
  .Grid td {   
      padding: 2px;  
      font-family: Calibri; 
      border: solid 1px #c1c1c1;   
      color: #000000;   
      text-align:right;
      padding: 2px 4px 3px 4px;}  
  
  /*Gridview table header*/
  .Grid th {   
      padding: 4px 2px;   
      color: #fff; 
      font-family:Calibri;
      background: #424242 url(Images/gridheader.png) repeat-x top;   
      border-left: solid 1px #525252;   
      font-size: 95%;   }  
  
  /*Gridview alternate rows*/
  .Grid .alt { background: #fcfcfc url(Images/grid-alt.png) repeat-x top; }  
  </code></pre>