I'm trying to get started with EJ/MVC and, to be honest, having a lot of trouble. I created a new MVC app, and followed the instructions
here for how to make it into a Syncfusion app. I'm using Entity Framework with "code first" modeling.
I have a model:
public class Group
{
public Guid GroupID { get; set; }
public string Name { get; set; }
public int SortOrder { get; set; }
}
and a controller/view, scaffolded by the "add controller" menu, to which I added a grid:
@model IEnumerable<WebApplication4.Models.Group>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
@(Html.EJ().Grid<WebApplication4.Models.Group>("GridContainer")
.Datasource(Model)
.Columns(col =>
{
col.Field("GroupID").HeaderText("ID").Add();
col.Field("Name").HeaderText("Name").Add();
col.Field("SortOrder").HeaderText("Order").Add();
})
.AllowPaging()
)
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.SortOrder)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.SortOrder)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.GroupID }) |
@Html.ActionLink("Details", "Details", new { id=item.GroupID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.GroupID })
</td>
</tr>
}
</table>
I used the "create new" button to add a couple of rows. The rows show up in the scaffolded table, but the grid only shows the header & footer. It obviously knows that there ARE rows, as it says "2 items" in the footer. If I look at the page source, the rendered table just has a <tr> with empty <td>s in it.
I'm assuming that there is something simple and/or fundamental that I'm missing... any suggestions?
brian