dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.38k stars 10k forks source link

Testing QuickGrid and examples do not work. #43440

Closed silentdevnull closed 2 years ago

silentdevnull commented 2 years ago

Trying to test the new quickgrid and when using the example from the web site. https://aspnet.github.io/quickgridsamples/getstarted

I'm using dotnet 6 which says it supported.

Error is in the @(p => p.PersonId) Error message is Index.razor(17,33): error CS1660: Cannot convert lambda expression to type 'bool' because it is not a delegate type

Steps to recreate.

dotnet new blazorserver dotnet add package Microsoft.AspNetCore.Components.QuickGrid --prerelease

Copy and paste in to index.razor

<QuickGrid Items="@people">
    <PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
    <PropertyColumn Property="@(p => p.Name)" Sortable="true" />
    <PropertyColumn Property="@(p => p.BirthDate)" Format="yyyy-MM-dd" Sortable="true" />
</QuickGrid>

@code {
    record Person(int PersonId, string Name, DateOnly BirthDate);

    IQueryable<Person> people = new[]
    {
        new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)),
        new Person(10944, "António Langa", new DateOnly(1991, 12, 1)),
        new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)),
        new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)),
        new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)),
        new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)),
    }.AsQueryable();
}
silentdevnull commented 2 years ago

I figured it out.

I didn't have the package imported.

@using Microsoft.AspNetCore.Components.QuickGrid