No data rendered inG rid

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

2 Replies

GS Grant Stephen January 31, 2017 02:16 PM UTC

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

G


JK Jayaprakash Kamaraj Syncfusion Team 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. 


Loader.
Up arrow icon