We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error with EjsGrid

I'm testing the Blazor grid component with my entity framework classes, I don't understand why I get this error when I use the TtkTicket object. With other types of objects it looks ok. My code is this:

@page "/fetchdata"

@using Syncfusion.EJ2.Blazor.Grids
@using Microsoft.EntityFrameworkCore

@*@inject WeatherForecastService ForecastService*@

Grid test


@if (tickets == null)
{
   

Caricamento...

}
else
{
   
       
       
       
   
}


@code {
    public customerContext _context { get; set; }
    public IQueryable tickets { get; set; }

    protected override void OnInitialized()
    {
        _context = new customerContext();
        try
        {
            tickets = _context.TtkTicket.Select(x => new TtkTicket{ TicketId = x.TicketId, TicketCode = x.TicketCode, StartDate = x.StartDate, Number = x.Number, Protocol = x.Protocol}).AsQueryable();
        }
        catch(Exception ex)
        {

        }        
    }
}

the error is:
System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: BlazTempId_1215471834)
 ---> System.ArgumentException: An item with the same key has already been added. Key: BlazTempId_1215471834

Attched the project and erros.
Thanks
Adriano

Attachment: BlazorApp2_a02a8ca9.zip


3 Replies

RS Renjith Singh Rajendran Syncfusion Team December 16, 2019 01:14 PM UTC

Hi adrianodn, 

Thanks for contacting Syncfusion support. 

The reported issue might occur while inserting/having with duplicate primaryKey value in database or while inserting a dictionary values into database. So kindly ensure that you are inserting/having records in database with unique primary key values.   

If you are still facing the issue, even after ensuring the above scenario. Kindly confirm the following details about your dataSource.  

  1. Have you bound Grid with large dataSource?. If yes, kindly get back to us with type of dataSource and count.
  2. Because reported issue might also occur when dataSource is large. 

The provided information will help us analyze the problem, and provide you a solution as early as possible. 

And also we are facing the below script error “The server was not found or was not accessible” when try running the attached sample.  

 

Regards, 
Renjith Singh Rajendran. 



AD adrianodn December 17, 2019 06:51 PM UTC

Thanks for the reply. Yes the datasource contains about 180000 rows and I made sure that there are no duplicates on the primary key.
I updated the components to version 17.4.0.39

I think i have solved by follow this doc page.

Thank you!!




RS Renjith Singh Rajendran Syncfusion Team December 18, 2019 05:17 AM UTC

Hi adrianodn, 

Thanks for your update. 

We are glad to hear that you have resolved your problem. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Live Chat Icon For mobile
Up arrow icon