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

How do I get QuickGrid with multiple tables to work without erroring?

$
0
0

I am trying to get the following code to work but it is giving me an error:

Severity    Code    Description Project File    Line    Suppression StateError (active)  CS0411  The type arguments for method 'TypeInference.CreateQuickGrid_0_CaptureParameters<TGridItem>(string, out string, IQueryable<TGridItem>, out IQueryable<TGridItem>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. BlazorApp1  C:\Users\me\source\repos\BlazorApp1\BlazorApp1\Components\Pages\BoardPages\Index.razor  20  
@page "/boards"@using Microsoft.AspNetCore.Components.QuickGrid@inject BlazorApp1.Data.ApplicationDbContext DB@using BlazorApp1.Data<PageTitle>Index</PageTitle><h1>Index</h1><p><a href="boards/create">Create New</a></p>@if (result == null){<div>Loading....</div>}else{<QuickGrid Class="table" Items="result" ><PropertyColumn Property="BoardView => BoardView.Code" /><PropertyColumn Property="BoardView => BoardView.Name" /><PropertyColumn Property="BoardView => BoardView.LowestPrice" /><PropertyColumn Property="BoardView => BoardView.SupplierName" /><TemplateColumn Context="board"><a href="@($"boards/edit?id={BoardView.ID}")">Edit</a> |<a href="@($"boards/details?id={BoardView.ID}")">Details</a> |<a href="@($"boards/delete?id={BoardView.ID}")">Delete</a></TemplateColumn></QuickGrid>}@code {    public class BoardView    {        public int BoardID { get; set; }        public string Code { get; set; }        public string Name { get; set; }        public double LowestPrice { get; set; }        public string SupplierName { get; set; }    }    private IEnumerable<BoardView>? result; // Move this declaration outside any method or block    protected override async Task OnInitializedAsync()    {        var boardPrices = from board in DB.Board                          join boardSupplier in DB.BoardSupplier on board.ID equals boardSupplier.Board.ID                          join supplier in DB.Supplier on boardSupplier.Supplier.Id equals supplier.Id                          group new { board, boardSupplier, supplier } by new { board.ID, board.Code, board.Name } into grouped                          select new BoardView                          {                              BoardID = grouped.Key.ID,                              Code = grouped.Key.Code,                              Name = grouped.Key.Name,                              LowestPrice = grouped.Min(x => x.boardSupplier.Price),                              SupplierName = grouped.FirstOrDefault(x => x.boardSupplier.Price == grouped.Min(y => y.boardSupplier.Price)).supplier.Name                          };        result = boardPrices.ToList();    }    }

I have been trying for hours and no luck, I just want to be able to build custom data from multiple tables and display it in QuickGrid....

Jon

Expected it to work, as it has the correct class.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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