Sebi
Sebi

Reputation: 3979

Blazor Radzen Grid doesn't show any data

I'm using Radzen Datagrid in Blazor Webassembly to show some data. I have this easy example on a blazor page:

@page "/admincenter"
@using Dashy.Client.Components

<h3>Dashy Administration</h3>

<RadzenGrid TItem="Person" Data="@_employees" Count="@_count">
    <Columns>
        <RadzenDataGridColumn TItem="Person" Property="FirstName" Title="First Name" />
        <RadzenDataGridColumn TItem="Person" Property="LastName" Title="Last Name" />
        <RadzenDataGridColumn TItem="Person" Property="DayOfBirth" Title="Birthday" />
    </Columns>
</RadzenGrid>

@code {

    private IEnumerable<Person> _employees;
    private int _count;

    protected override Task OnInitializedAsync()
    {
        List<Person> persons = new List<Person>();
        var person1 = new Person { Id = new Guid(), FirstName = "Max", LastName = "Mustermann", DayOfBirth = new DateTime(1990, 5, 19) };
        var person2 = new Person { Id = new Guid(), FirstName = "Sabine", LastName = "Sonntag", DayOfBirth = new DateTime(1992, 4, 29) };
        persons.Add(person1);
        persons.Add(person2);

        _employees = persons;
        _count = persons.Count;

        return base.OnInitializedAsync();
    }
}

But this only shows a small grey line like shown in this picture: enter image description here

Someone have an idea what i'm missing?

Upvotes: 1

Views: 4938

Answers (3)

jaimenino
jaimenino

Reputation: 64

As AnC Dev shows, you must use RadzenDataGrid whith RadzenDataGridColumn and RadzenGrid with RadzenGridColumn

Upvotes: 0

AnC Dev
AnC Dev

Reputation: 163

you have to use either Legacy RadzenGrid:

<RadzenGrid TItem="Person" Data="@_employees" Count="@_count">
    <Columns>
        <RadzenGridColumn TItem="Person" Property="FirstName" Title="First Name" />
        <RadzenGridColumn TItem="Person" Property="LastName" Title="Last Name" />
        <RadzenGridColumn TItem="Person" Property="DayOfBirth" Title="Birthday" />
    </Columns>
</RadzenGrid>

or RadzenDataGrid:

<RadzenDataGrid  TItem="Person" Data="@_employees" Count="@_count">
    <Columns>
        <RadzenDataGridColumn TItem="Person" Property="FirstName" Title="First Name" />
        <RadzenDataGridColumn TItem="Person" Property="LastName" Title="Last Name" />
        <RadzenDataGridColumn TItem="Person" Property="DayOfBirth" Title="Birthday" />
    </Columns>
</RadzenDataGrid >

Upvotes: 2

mmura
mmura

Reputation: 36

Try change <RadzenGrid> with <RadzenDataGrid>

Upvotes: 1

Related Questions