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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Data Will not appear in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

150625 Jan 14,2020 03:32 AM UTC Jan 20,2020 10:30 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: DataGrid
J
Asked On January 14, 2020 03:32 AM UTC

Full project at https://github.com/jlongo62/EssentialJS2WebApplication3

Data will not fill in grid.
I build the project using Syncfusion Template
Copied the index.htnl page directly from sample (unfortunately it was core 2.0)
Index page will not fill with data.

Index.cshtml
@page
@model EssentialJS2WebApplication3.IndexModel

<h1>razor1</h1>
<h1>Hello, world!</h1>
<h2>The time on the server is @DateTime.Now</h2>
@{
    <ejs-grid id="cruiseLinesGrid" dataSource=@Model.Datasource allowPaging="true">
        <e-grid-columns>
            <e-grid-column field="EmployeeID" headerText="Employee ID" textAlign="Right" width="125"></e-grid-column>
            <e-grid-column field="OrderID" headerText="OrderID" width="120"></e-grid-column>
            <e-grid-column field="CustomerID" headerText="CustomerID" width="170"></e-grid-column>
            <e-grid-column field="OrderDate" headerText="OrderDate" format='yMd' textAlign="Right" width="135"></e-grid-column>
            <e-grid-column field="Freight" headerText="Freight" width="120"></e-grid-column>
        </e-grid-columns>
    </ejs-grid>
}


Index.cshtml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace EssentialJS2WebApplication3
{
    public class IndexModel : PageModel
    {
        public System.Collections.Generic.List<OrdersDetails> Datasource { get; set; }
        public string WelcomeMessage { get; set; }
        public void OnGet()
        {
            Datasource = OrdersDetails.GetAllRecords().ToList();

            WelcomeMessage = "WelCome to Razor Pages by Saineshwar Bageri";

        }
    }
}
public class OrdersDetails
{
    public static List<OrdersDetails> order = new List<OrdersDetails>();
    public OrdersDetails()
    {

    }
    public OrdersDetails(int OrderID, string CustomerId, int EmployeeId, double Freight, bool Verified, DateTime OrderDate, string ShipCity, string ShipName, string ShipCountry, DateTime ShippedDate, string ShipAddress)
    {
        this.OrderID = OrderID;
        this.CustomerID = CustomerId;
        this.EmployeeID = EmployeeId;
        this.Freight = Freight;
        this.ShipCity = ShipCity;
        this.Verified = Verified;
        this.OrderDate = OrderDate;
        this.ShipName = ShipName;
        this.ShipCountry = ShipCountry;
        this.ShippedDate = ShippedDate;
        this.ShipAddress = ShipAddress;
    }
    public static List<OrdersDetails> GetAllRecords()
    {
        if (order.Count() == 0)
        {
            int code = 10000;
            for (int i = 1; i < 2; i++)
            {
                order.Add(new OrdersDetails(code + 1, "ALFKI", i + 0, 2.3 * i, false, new DateTime(1991, 05, 15), "Berlin", "Simons bistro", "Denmark", new DateTime(1996, 7, 16), "Kirchgasse 6"));
                order.Add(new OrdersDetails(code + 2, "ANATR", i + 2, 3.3 * i, true, new DateTime(1990, 04, 04), "Madrid", "Queen Cozinha", "Brazil", new DateTime(1996, 9, 11), "Avda. Azteca 123"));
                order.Add(new OrdersDetails(code + 3, "ANTON", i + 1, 4.3 * i, true, new DateTime(1957, 11, 30), "Cholchester", "Frankenversand", "Germany", new DateTime(1996, 10, 7), "Carrera 52 con Ave. Bolívar #65-98 Llano Largo"));
                order.Add(new OrdersDetails(code + 4, "BLONP", i + 3, 5.3 * i, false, new DateTime(1930, 10, 22), "Marseille", "Ernst Handel", "Austria", new DateTime(1996, 12, 30), "Magazinweg 7"));
                order.Add(new OrdersDetails(code + 5, "BOLID", i + 4, 6.3 * i, true, new DateTime(1953, 02, 18), "Tsawassen", "Hanari Carnes", "Switzerland", new DateTime(1997, 12, 3), "1029 - 12th Ave. S."));
                code += 5;
            }
        }
        return order;
    }

    public int? OrderID { get; set; }
    public string CustomerID { get; set; }
    public int? EmployeeID { get; set; }
    public double? Freight { get; set; }
    public string ShipCity { get; set; }
    public bool Verified { get; set; }
    public DateTime OrderDate { get; set; }

    public string ShipName { get; set; }

    public string ShipCountry { get; set; }

    public DateTime ShippedDate { get; set; }
    public string ShipAddress { get; set; }
}


Attachment: EssentialJS2WebApplication3_7a147080.zip

Sujith Kumar Rajkumar [Syncfusion]
Replied On January 20, 2020 10:30 AM UTC

Hi Joseph, 
 
Greetings from Syncfusion support. 
 
We checked your query with the attached sample and suspect this issue is due to package version mismatch that might have occurred on creating the project. As you have mentioned that the index file was copied from older version sample it might not be suitable for the latest dotnet version. So we suggest you to follow the steps provided in the below help documentation for creating the project, 
 

We have also created a sample for your reference with Core 3.0 based on the sample you had provided. You can find it below, 


Please check it and get back to us if you have any further queries. 

Regards, 
Sujith R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon