title: Highlight gridview row based on datatable values
body: <p>I need to highlight gridview rows based on values from datatable.
  I have highlighted values like if any particular cell values has met some conditions then I can highlight using this code.</p>
  
  <pre><code>if(int.Parse(DataBinder.Eval(e.Row.DataItem,"Risk").ToString()) &gt; 100)
      {
          e.Row.BackColor = Color.FromName("#FAF7DA");
      }
  </code></pre>
  
  <p>Now my questions is, in my rowdatabound event I want to check values in datatable and I need to highlight values in the gridview.</p>
  
  <pre><code>protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          { 
              DataTable dt = DataRepository.highlightRow();
              string[] strInactive = dt.AsEnumerable().Select(row =&gt; row.Field&lt;string&gt;("product_id")).ToArray();
              foreach (GridViewRow row in gvProducts.Rows)
              {
                  for (int i = 0; i &lt; gvProducts.Columns.Count; i++)
                  {
                      if (gvProducts.Rows[0].Cells[0].Text.Contains("how to pass array values"))
                      {
                          e.Row.BackColor = System.Drawing.Color.Red;
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>For ex:
  Here the datatable will return only one column values like this,10, 20, 20. Then I need to highlight rows of these values in the gridview.</p>