Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

No data displayed when using Radzen Data Grid

$
0
0

I'm using Radzen Data Grid to display users from the AspNetUsers table but no data is displayed.

This is my code below:

@page "/contacts"@rendermode InteractiveServer@using BlazorApp1.Data@using BlazorApp1.Models@using Microsoft.EntityFrameworkCore@inject ApplicationDbContext DbContext<h3>Contact</h3><RadzenDataGrid AllowFiltering="true" PageSize="5" Data="@employees" SelectionMode="DataGridSelectionMode.Single" @bind-Value="@selectedEmployees"><RadzenDataGridColumn Property="@nameof(ApplicationUser.Id)" Filterable="false" Title="ID" Frozen="true" TextAlign="TextAlign.Center" /><RadzenDataGridColumn Property="@nameof(ApplicationUser.Name)" Filterable="true" Title="Name" Frozen="true" TextAlign="TextAlign.Left" /><RadzenDataGridColumn Property="@nameof(ApplicationUser.OrgUnitId)" Filterable="true" Title="Org/Unit" Frozen="true" TextAlign="TextAlign.Left" /><RadzenDataGridColumn Property="@nameof(ApplicationUser.PhoneNumber)" Filterable="true" Title="Phone Number" Frozen="true" TextAlign="TextAlign.Left" /></RadzenDataGrid>@code {    IEnumerable<ApplicationUser> employees;    IList<ApplicationUser> selectedEmployees = new List<ApplicationUser>();    protected override async Task OnInitializedAsync()    {        await base.OnInitializedAsync();        employees = await DbContext.Users.ToListAsync();        selectedEmployees = new List<ApplicationUser>() { employees.FirstOrDefault() };    }}

I'm using server-side rendermode and SQL server for the database. Is there anything wrong with the way I implement it?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>