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 Feedback

No data rendered inG rid

Thread ID:

Created:

Updated:

Platform:

Replies:

128600 Jan 31,2017 01:54 PM UTC Feb 1,2017 06:32 AM UTC ASP.NET MVC 2
loading
Tags: Grid
Grant Stephen
Asked On January 31, 2017 01:54 PM UTC

Trying to pull dat from controller to a simple grid as a learning curve for Syncfusion MVC grid, page shoew no data yet the controller has two records in the action Result 
Controller:
   public ActionResult Index()
        {
            var leagues = db.Leagues.Include(l => l.Group).Include(l => l.User).Include(l => l.User1).ToList()
                .Select(l => new League
                {
                    LeagueID=l.LeagueID,
                    LeagueName=l.LeagueName
                   
                });
            ViewBag.datasource = leagues.ToList();
            return View();
        }

Razor:
@(Html.EJ().Grid<League>("leagues")
        .Datasource((IEnumerable<object>)ViewBag.leagues)

        .Columns(col =>
        {
            col.Field("LeagueID").IsPrimaryKey(true).HeaderText("ID").Add();

    
            col.Field("LeagueName").HeaderText("League").Add();
   


        })
        )
there are no JS errors in the console, any pointers

G

Grant Stephen
Replied On January 31, 2017 02:16 PM UTC

got the solution i was referencing the viewbag incorectly, my bad

G

Jayaprakash Kamaraj [Syncfusion]
Replied On February 1, 2017 06:32 AM UTC

Hi Grant, 
 
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.

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

;