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.
Unfortunately, activation email could not send to your email. Please try again.

Syncfusion.JavaScript.GridPropertiesBuilder Error

Thread ID:

Created:

Updated:

Platform:

Replies:

127303 Nov 8,2016 09:11 AM Nov 11,2016 03:38 AM ASP.NET Core 5
loading
Tags: Grid
Gary Whiteside
Asked On November 8, 2016 09:11 AM

Im getting this error, Syncfusion.JavaScript.GridPropertiesBuilder`1[myModelName] , on my page instead of the grid displaying data, Im new to Syncfusion so unsure what the problem is, I think I have all the files etc referenced correctly as I have another grid displaying data on the same page from an example I found in online documentation that uses a web service

View

//This doesnt work

@(Html.EJ().Grid<myModelName>("Grid2")

.Datasource((IEnumerable<myModelName>)ViewBag.dataSource)

.Columns(col =>

{

col.Field(p => p.ReferenceNumber).HeaderText("Reference Number").TextAlign(TextAlign.Center).Add();

col.Field(p => p.Title).HeaderText("Title").TextAlign(TextAlign.Center).Add();

col.Field(p => p.FullName).HeaderText("FullName").TextAlign(TextAlign.Center).Add();

}))

 


//This works

<ej-grid id="FlatGrid" allow-sorting="true" allow-paging="true">

<e-datamanager url="http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/?$top=45" offline="true"></e-datamanager>

<e-columns>

<e-column field="OrderID" header-text="Order ID" text-align="Right" width="75"></e-column>

<e-column field="CustomerID" header-text="Customer ID" width="80"></e-column>

<e-column field="EmployeeID" header-text="Employee ID" text-align="Left" width="75"></e-column>

<e-column field="Freight" header-text="Freight" format="{0:C2}" text-align=Right width="75"></e-column>

<e-column field="OrderDate" header-text="Order Date" format="{0:MM/dd/yyyy}" text-align=Right width="80"></e-column>

<e-column field="ShipCity" header-text="Ship City" width="110"></e-column>

</e-columns>

</ej-grid>



Controller



public IActionResult Index()
{


 ViewBag.dataSource= Repository.GetLatestData().ToList();


 return View();


}


I have debugged the code and there is 18 records being brought back into the ViewBag.

Any ideas what I could be doing wrong?


Thanks



Gary Whiteside
Replied On November 8, 2016 10:27 AM

Could I be mixing up MVC and Core?

Jayaprakash Kamaraj [Syncfusion]
Replied On November 9, 2016 08:49 AM

Hi Gary, 
 
In ASP.NET Core we need to render grid using Render method. Please refer to the below code example and sample.  
 
@{Html.EJ().Grid<object>("HierarchyGrid") 
                .Datasource(ds=>ds.Json(ViewBag.data)) 
                .AllowPaging() 
                .Columns(col => 
                { 
                    col.Field("OrderID").HeaderText("OrderID").Add(); 
                    col.Field("ShipCity").HeaderText("ShipCity").Add(); 
                    col.Field("Freight").Width(120).Format("{0:c2}").Add(); 
                }).Render(); 
}  
 

Regards, 
 
Jayaprakash K. 


Jayaprakash Kamaraj [Syncfusion]
Replied On November 9, 2016 08:51 AM

Hi Gary, 
 
In ASP.NET Core we need to render grid using Render method. Please refer to the below code example and sample.  
 
@{Html.EJ().Grid<object>("HierarchyGrid") 
                .Datasource(ds=>ds.Json(ViewBag.data)) 
                .AllowPaging() 
                .Columns(col => 
                { 
                    col.Field("OrderID").HeaderText("OrderID").Add(); 
                    col.Field("ShipCity").HeaderText("ShipCity").Add(); 
                    col.Field("Freight").Width(120).Format("{0:c2}").Add(); 
                }).Render(); 
}  
 

 
Regards, 
 
Jayaprakash K. 


Gary Whiteside
Replied On November 10, 2016 05:52 AM

Got it working thanks

Jayaprakash Kamaraj [Syncfusion]
Replied On November 11, 2016 03:38 AM

Hi Gary,  
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.   
 
Regards,  
 
Jayaprakash K. 


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.

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.

;