Hello
I am trying to create an ASP.NET MVC grid which binds to a model but it doesn't seem to render. I have used the VS extension to convert the project to Syncfusion MVC and have the following code:
Controller:
[HttpGet]
public ActionResult Create1()
{
List<Customer_Customer> C = new List<Customer_Customer>();
// add in items.
return View(C);
}
View:
@model IEnumerable<SyncfusionWebTest.Models.Customer_Customer>
@using System.Web.Mvc.Html;
@using Syncfusion.MVC.EJ;
@using Syncfusion.JavaScript;
@{
ViewBag.Title = "Create1";
}
<h2>Create1</h2>
<div>
@{(Html.EJ().Grid<SyncfusionWebTest.Models.Customer_Customer>("FlatGrid")
.Datasource((IEnumerable<SyncfusionWebTest.Models.Customer_Customer>)Model)
.AllowSorting()
.AllowPaging()
.Columns(col =>
{
col.Field(model => model.FirstName).HeaderText("a").IsPrimaryKey(true).Width(75).Add();
col.Field(model => model.LastName).HeaderText("a").Width(80).Add();
})).Render();
}
//Test- This part is visible and contains data.
@foreach (var item in Model)
{
<div>
@Html.DisplayFor(modelItem => item.FirstName)
</div>
<div>
@Html.DisplayFor(modelItem => item.LastName)
</div>
}
</div>
Also, I notice in the demo that you render two sections called "ControlsSection" and "SampleHeading" what are these used for and do I need to use these in my code? If so where do I find the scripts?
Thank You