title: kendo ui grid row how to set background color?
body: <p>I need to change the row color of a kendo ui grid depending on a particular condition.  I am using server side bindings with MVC.  My code is as follows,</p>
  
  <pre><code>var grid = Html.Kendo().Grid&lt;AllocateCOESGridViewModel&gt;();
  grid.Name("AllocateResultGrid")
  .RowAction(row =&gt;
  {
     if (row.DataItem.COESNo == 13054915)
     {
         row.HtmlAttributes["style"] = "background:blue";
     }
     else
     {
         row.HtmlAttributes["style"] = "background:red";
     }                
  })  
  .Columns(columns =&gt;
  {   
      columns.Bound(s =&gt; s.COESNo).Title(@Allocate.COESGridHeading);                  
      columns.Bound(s =&gt; s.Street).Title(@Allocate.StreetGridHeading);
      columns.Bound(s =&gt; s.Suburb).Title(@Allocate.SuburbGridHeading);
      columns.Bound(s =&gt; s.Postcode).Title(@Allocate.PostcodeGridHeading);
      columns.Bound(s =&gt; s.InspectorName).Title(@Allocate.InspectorGridHeading);
      columns.Bound(s =&gt; s.COESNo).Title(@Allocate.AllocateGridHeading + "&lt;input type ='checkbox' id ='SelectAll'  /&gt;").ClientTemplate("&lt;input type ='checkbox' data-id='#= COESNo #' class='allocate' /&gt;").Sortable(false);
  });
  </code></pre>
  
  <p>The grid works but no row colors at all? no blue or red.. I just get the standard white and grey.. any thoughts?</p>
  
  <p>Thanks</p>
  
  <p>This is how I got this to work, just wondering if there is any other options, as looping through the grid seems like a not so good idea... especially if the grid is long</p>
  
  <pre><code> var grid = $("#AllocateResultGrid").data("kendoGrid");
   grid.bind("dataBound", updateGridRows);
  
   updateGridRows: function()
  {
      dataView = this.dataSource.view();
      for (var i = 0; i &lt; dataView.length; i++) 
      {
          if (dataView[i].Selected == false) 
          {
              var uid = dataView[i].uid;
              $("#AllocateResultGrid tbody").find("tr[data-uid=" + uid + "]").addClass("customClass");
          }
      }
  
  }
  </code></pre>
  
  <p>I added the customClass in my stylesheet</p>