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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Simple Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

127982 Dec 22,2016 05:01 PM UTC Jan 9,2017 04:07 AM UTC ASP.NET MVC 3
loading
Tags: Grid
Grant Stephen
Asked On December 22, 2016 05:01 PM UTC

New to syncfusion and having great difficulty in rendering a simple grid, have gone through circular reference issues and such like but now can render the grid but there's no data rendering, 
controller
  public ActionResult Index()
        {

            ViewBag.datasource = db.Users.ToList();
            return View();
        }

View
@using WMS.Models

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

@(Html.EJ().Grid<User>("Grid")
               .Datasource((IEnumerable<User>)ViewBag.datasource)
)





Prasanna Kumar Viswanathan [Syncfusion]
Replied On December 23, 2016 11:14 AM UTC

Hi Stephen, 

Thanks for contacting Syncfusion support. 

            Queries 
                                          Response 

Circular Reference issues 


The circular reference error in data is resolved by using the select method. The following error is due to when we have same table, then object cannot be serialized. So, we suggest you to use select method to get the selected data from the table. For the following error please refer this link 

Please find the below code snippet for avoid the circular reference error: 
 
NORTHWNDEntities ds = new NORTHWNDEntities(); 
IEnumerable DataSource = OrderRepository.GetAllRecords(); 
DataSource = ds.Orders.Include("Customer").ToList(); 
result.result = DataSource.Cast<Order>().Select(x => new 
{ 
OrderID = x.OrderID, 
CustomerID = x.CustomerID, 
Freight = x.Freight, 
Customer = new 
{ 
CustomerID = x.Customer.CustomerID, 
}
}); 



Data is not rendered 


You have mentioned that data is not rendered on the grid. So, please confirm the following details to find out the root cause of the issue.  

1. Did you face any script error in the console? If yes, share the screenshot and stackrace of an issue. 

2. Ensure that you have referred the following script file in your sample. 


jquery.min.js 

jsrender.min.js 

ej.web.all.min.js 
 
If you enable the unobstrusive in the web.config, we suggest you to refer the ej.unobstrusive.min.js file in your sample. 
 


3. Code example of a Grid. 

4. Ensure that you have referred set “@Html.EJ().ScriptManager()” in _Layout file. The main reason for referring the ScriptManager in _Layout file is that, it can be referred as common by all the View files present within your application and it should be included in the _Layout.cshtml.  

5. Essential Studio Version details. 


Try the attached sample and still if you face the issue please provide above details it will helpful to provide the better solution.  

Refer to the Help document of Getting started. 

  



Regards, 
Prasanna Kumar N.S.V 


Grant Stephen
Replied On January 6, 2017 02:35 PM UTC

any thanks, used a combination of Select new and viewModel 

Prasanna Kumar Viswanathan [Syncfusion]
Replied On January 9, 2017 04:07 AM UTC

Hi Stephen, 

We are happy to hear that your issue has been resolved. 

Please let us know if you need any further assistance. 

Regards, 
Prasanna Kumar N.S.V 


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.

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

;