LoadData event are not fired

Hi when are the LoadData event fired? My LoadData eventhandler are never called.
Have been reading this example over and over but can't get it to work.

 <RadzenGrid @ref="ContactsGrid"
         Data="@Contacts"
         Count="@ContactsCount"
         LoadData="@GridLoadData"
         TItem="Contact"
         AllowSorting="true"
         AllowFiltering="true"
         AllowPaging="true"
         FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
         RowDoubleClick="@(item => GridEditButtonClick(item))" @onclick:stopPropagation="true"
         RowSelect="args => SelectedContact = (Contact)args"
         PageSize="25"
         Style="max-width: 1500px">
 <Columns>
     <RadzenGridColumn TItem="Contact" Property="FirstName" Title="First name" />
     <RadzenGridColumn TItem="Contact" Property="LastName" Title="Last name" />
     <RadzenGridColumn TItem="Contact" Property="Title" Title="Title" />
     <RadzenGridColumn TItem="Contact" Property="Phone" Title="Phone" />
     <RadzenGridColumn TItem="Contact" Property="Mobile" Title="Mobile" />
     <RadzenGridColumn TItem="Contact" Property="Customer.CompanyName" Title="Customer" />
     <RadzenGridColumn TItem="Contact" Property="Customer.AddressCity" Title="Customer city" />
     <RadzenGridColumn TItem="Contact" Filterable="false" Sortable="false" Width="70px" TextAlign="TextAlign.Center">
         <Template Context="data">
             <RadzenButton ButtonStyle="ButtonStyle.Primary" Icon="create" Size="ButtonSize.Small" Click="@(_ => GridEditButtonClick((Contact)data))" @onclick:stopPropagation="true">
             </RadzenButton>
         </Template>
     </RadzenGridColumn>
 </Columns>

This is my eventhandler

 private async Task GridLoadData(LoadDataArgs args)
  {
 try
 {
     var res = await ODataListService.GetCustomerContacts(filter:$"{args.Filter}", @orderby:$"  {args.OrderBy}", top:args.Top, skip:args.Skip, count:args.Top != null && args.Skip != null);
     Contacts = res.Value.AsODataEnumerable();
     ContactsCount = res.Count;
     StateHasChanged();
  }
 catch (Exception)
 {
     NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to load CustomerContacts");
 }
 }

And my OData controller, that's workes

 [ApiController]

[Route("api/[controller]")]
public class CustomerContactsController : ControllerBase
{
private readonly SamDBContext _context;

 public CustomerContactsController(SamDBContext context)
 {
     _context = context;
 }

 [HttpGet]
 [EnableQuery(MaxExpansionDepth = 10, MaxAnyAllExpressionDepth = 10, MaxNodeCount = 100, PageSize = 100)]
 public IEnumerable<Contact> GetCustomerContacts()
 {
     return _context.Contacts.Include(x => x.Customer).Where(x => x.Active).AsQueryable();
 }

}

1 Like