title: How to set Blasorise.DataGrid cell's forecolor at run-time?
body: <p>How to set <a href="https://blazorise.com/docs/extensions/datagrid/getting-started" rel="nofollow noreferrer">Blazorise.DataGrid</a> cell's forecolor at run-time?
  I wanted the forecolor of the sample weather forecast app's <strong>Temp.C.</strong> cells to be set depending on their values, for example,</p>
  <ul>
  <li>if a value is less than Zero - then the color should be set to <strong>Blue</strong>;</li>
  <li>if a value is between zero and 19 - then the color should be set to <strong>Orange</strong>;</li>
  <li>else  - the color should be set to <strong>Red</strong>;</li>
  </ul>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    @page "/fetchdata"
  
      &lt;PageTitle&gt;Weather forecast&lt;/PageTitle&gt;
  
      @using BlazoriseDemo.Data
      @using Blazorise;
  
      @inject WeatherForecastService ForecastService
  
      &lt;h1&gt;Weather forecast&lt;/h1&gt;
  
      &lt;p&gt;This component demonstrates fetching data from a service.&lt;/p&gt;
  
      @if (forecasts == null)
      {
          &lt;p&gt;&lt;em&gt;Loading...&lt;/em&gt;&lt;/p&gt;
      }
      else
      {
  
          &lt;DataGrid TItem="WeatherForecast"
                Data="@forecasts"
                @bind-SelectedRow="@selectedForecast"
                Responsive&gt;
      
                &lt;DataGridColumn Field="@nameof(WeatherForecast.Date)" Caption="Date"/&gt;
                &lt;DataGridNumericColumn Field="@nameof(WeatherForecast.TemperatureC)" Caption="C" /&gt;
                &lt;DataGridNumericColumn Field="@nameof(WeatherForecast.TemperatureF)" Caption="F" /&gt;
                &lt;DataGridColumn Field="@nameof(WeatherForecast.Summary)" Caption="Summary"/&gt;
  
          &lt;/DataGrid&gt;
  
      }
  
      @code {
          private WeatherForecast selectedForecast;
          private WeatherForecast[]? forecasts;
  
          protected string getTempCForegroundColor(int temperatureC)
          {
              var color = "blue";
              if (temperatureC &gt;= 0 &amp;&amp; temperatureC &lt; 20) color = "orange";
              else if (temperatureC &gt; 20) color = "red";
              return color;
          }
  
          protected override async Task OnInitializedAsync()
          {
              forecasts = await new WeatherForecastService().GetForecastAsync(new DateTime(2022,07,1));
          }
      }</code></pre>
  </div>
  </div>
  </p>