0

I am trying to use JQWidgets in my ASP.net MVC application but I don't see any data in JqxGrid.

here is the view containing the grid.

@model IEnumerable<jQWidgets.AspNet.Core.Models.Employee>

@{
    ViewData["Title"] = "ASP .NET MVC Grid Example";
}
<label>ASP .NET Core MVC Grid Tag Helper Example</label><br/><br/>
<jqx-grid theme="@ViewData["Theme"]" sortable="true" filterable="true" autoheight="true" width="850" source="Model"> 
    <jqx-grid-columns>
        <jqx-grid-column columngroup="name" datafield="FirstName" width="100" text="First Name"></jqx-grid-column>
        <jqx-grid-column columngroup="name" datafield="LastName" width="100" text="Last Name"></jqx-grid-column>
        <jqx-grid-column datafield="Title" width="150"></jqx-grid-column>
        <jqx-grid-column datafield="Address" width="200"></jqx-grid-column> 
        <jqx-grid-column datafield="City" width="150"></jqx-grid-column>
        <jqx-grid-column datafield="Country"></jqx-grid-column>
  </jqx-grid-columns>
    <jqx-grid-column-groups>
        <jqx-grid-column-group name="name" text="Name"></jqx-grid-column-group>
    </jqx-grid-column-groups>
</jqx-grid>

And here is the controller that does return 5 employee records in the list.

public ActionResult Index()
{
    return View(_context.Employees.ToList());
}

I see an empty jqxgrid on the page.

enter image description here

All the required jqx scripts are added in the _layout.cshtml file using Bundles. Also, I have a similar grid on another page showing same information using Ajax/jquery which works just fine but I want to avoid using that way.

WAQ
  • 2,556
  • 6
  • 45
  • 86
  • Does _context.Employees.ToList() have records in it? Is there any error in the console? – who-aditya-nawandar Sep 24 '17 at 06:11
  • @adityawho yes the list does return 5 records which can be displayed on the same page in any other control ( e.g `@Html.DropDownListFor`) and I see no error on the console either. – WAQ Sep 24 '17 at 08:22
  • Then I am guessing the binding is wrong, may be the column names or no. of columns or something. I am not very sure though. – who-aditya-nawandar Sep 24 '17 at 08:59

0 Answers0