title: Calculating percentage in a column on Blazorise datagrid
body: <p>I have a Blazor app that I am working on for sales and I am trying to work out a column for percentage. This column is not stored in the database as the calculation should happen on the web form. I cannot seem to figure out where I am going wrong, I get a <code>selectedItem is null</code> error when I run my page.</p>
  <p>my razor page:</p>
  <pre><code>&lt;DataGrid TItem=&quot;SalesTable&quot;
            Data=&quot;@sales&quot;
            Sortable=&quot;true&quot;
            Filterable=&quot;false&quot;
            Editable=&quot;true&quot;
            ShowPager=&quot;true&quot;
            PageSize=&quot;10&quot;
            UseInternalEditing=&quot;true&quot;
            EditMode=&quot;DataGridEditMode.Inline&quot;
            RowUpdated=&quot;@OnRowUpdated&quot;
            RowInserted=&quot;@OnRowInserted&quot;
            RowRemoved=&quot;@OnRowRemoved&quot;
            NewItemDefaultSetter=&quot;@OnNewItemDefaultSetter&quot;
            @bind-SelectedRow=&quot;@selectedItem&quot;
            Striped=&quot;true&quot;
            Bordered=&quot;true&quot;
            Hoverable=&quot;true&quot;
            Responsive=&quot;true&quot;
            &gt;
        @{
              decimal percentagecalc = selectedItem.salesvalue/sumOfSales*100;
          }
          &lt;DataGridNumericColumn  Field=@nameof(@percentagecalc) Caption=&quot;Percentage&quot; Editable=&quot;false&quot;&gt;&lt;/DataGridNumericColumn&gt;
  &lt;/DataGrid&gt;
  @code
  {
  
      private List&lt;SalesTable&gt; sales;
      private SalesTable selectedItem;
      string selectedDropValue { get; set; }
      private decimal sumOfSales;
    
  
      protected override async Task OnInitializedAsync()
      {
          budgets = await SalesService.GetSalesTablesAsync();
          sumOfSales=Sales.Sum(f =&gt; f.salesvalue);
          
  
      }
  }
  </code></pre>
  <p>does anyone know what I am doing wrong?</p>