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

Grid with Ef Core 3.1

Hello Communitiy

I use ASP.NET Core 3.1 MVC Web App. I have following codes. I just want to show a the model class objects in the Grid. I alsow want to to a CRUD with the grid. To save the data I use EF Core.

I have no ieda why it doesn't show some data, because from the Request I get data.

Request Response: 

I feel a bit stupid. I hope you can help. I think it isn't a big problem, but I need the correct hint.

Thanks a lot.


public class TransactionType
     public Guid Id { get; set; }
     public string Name { get; set; }
     public IEnumerable<Category> Categories { get; set; }

public class BudgetControlDbContext : IdentityDbContext<Member, IdentityRole<Guid>, Guid>
     public BudgetControlDbContext(DbContextOptions options) : base(options) { }
      public DbSet<TransactionType> TransactionTypes { get; set; }

public class TransactionTypesController : Controller
     private readonly BudgetControlDbContext _context;
     public TransactionTypesController(BudgetControlDbContext context)
          _context = context;
     public IActionResult Index() => View();
     public IActionResult UrlDatasource([FromBody]DataManagerRequest dataManager)
          IEnumerable dataSource = _context.TransactionTypes.ToList();
          var operation = new DataOperations();
          if (dataManager.Search != null && dataManager.Search.Count > 0)  dataSource = operation.PerformSearching(dataSource, dataManager.Search);
          if (dataManager.Sorted != null && dataManager.Sorted.Count > 0)  dataSource = operation.PerformSorting(dataSource, dataManager.Sorted);
          if (dataManager.Where != null && dataManager.Where.Count > 0) dataSource = operation.PerformFiltering(dataSource, dataManager.Where,           dataManager.Where[0].Operator);
          var count = dataSource.Cast<TransactionType>().Count();
          if (dataManager.Skip != 0)  dataSource = operation.PerformSkip(dataSource, dataManager.Skip);
          if (dataManager.Take != 0)  dataSource = operation.PerformTake(dataSource, dataManager.Take);
          return dataManager.RequiresCounts ? Json(new { result = dataSource, count = count }) : Json(dataSource);
     public ActionResult Insert(TransactionType value)
          return Json(value);
      public ActionResult Remove(Guid key)
          IEnumerable data = _context.TransactionTypes.ToList();
          var count = data.Cast<TransactionType>().Count();
          return Json(new { result = data, count });
     public ActionResult Update(TransactionType value)
          var transaction = value;
          var val = _context.TransactionTypes.SingleOrDefault(tt => tt.Id == transaction.Id);
          if (val != null) val.Name = transaction.Name;
          return Json(value);

My View .cshtml:
@(Html.EJS().Grid<TransactionType>("Grid").DataSource(dataManager =>
}).Width("auto").Columns(col =>
}).AllowPaging().EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(EditMode.Normal); })
    .Toolbar(new List<string> { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()) 

4 Replies

BS Balaji Sekar Syncfusion Team January 6, 2020 08:12 AM

Hi Gabriel, 
Thanks for contacting us. 
Before providing the query, It would be helpful to us to validate the issue, if you share the below details, 
  1. Share the Syncfusion Nuget version and CDN link version
  1. Share if any console error thrown
  1. Screenshot or video demo if the issue
  1. Bind the actionFailure event to Grid and share the stack trace (if any)
  1. If you have not any errors in console and actionFailure events , share the network tab screenshots
Meanwhile we are preparing the sample and update as soon as possible. 
Balaji Sekar. 

BS Balaji Sekar Syncfusion Team January 7, 2020 05:09 AM

Hi Gabriel, 
Thanks for your patience. 
We have prepared a sample with URL Adaptor for you convenience which can be downloaded from below link:  
In our end, it is working fine. So could you please check the provided sample if possible, try to replicate the issue in the given sample. 
If you still faced the issue, please share the network tab request, which will help us to validate the issue and provide the solution. 
For example:  
While Initial rendering Grid will request the server with skip and take parameters, 
In server the request: 
After performing server side paging data will be returned like this: