@(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()
{
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
@{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();
}
|
@{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();
}
|