I want to point out that if I am not using the Telerik grid, the data comes out fine (see below):
Controller
IEnumerable<YeagerTechWcfService.Customer> customerList = db.GetCustomers();
return View("Index", customerList);
See the attached index.zip file for the code in the View.
I have tried ServerSide and Ajax Binding. Both don't work. I have searched the Telerik site and the web and can't find out what is missing.
What do I need to do in order to resolve this and get the data in my grid?
Here is the code in my Customer controller for the Ajax binding (which is what I really want). Upon return of getting the data, you can see in the attached customerlist.png file that the data is in the customerList collection.
When the View is being rendered, I captured the attached grid.png file.
When cycling through the grid during the binding, I captured the attached gridcode.png file.
using Telerik.Web.Mvc;
public class CustomerController : Controller
{
[GridAction]
public ActionResult Index()
{
IEnumerable<YeagerTechWcfService.Customer> customerList = db.GetCustomers();
return View(new GridModel<YeagerTechWcfService.Customer>
{
Data = customerList
});
}
}
Below, is the code in my associated View. btw, all the bound columns have intellisense that pop up for the columns in my model. This is for the Index action within the Customer controller.
@model Telerik.Web.Mvc.GridModel<YeagerTech.YeagerTechWcfService.Customer>
@{
ViewBag.Title = "Customer Index";
}
<h2>
Customer Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
@(Html.Telerik().Grid<YeagerTech.YeagerTechWcfService.Customer>()
.Name("Customers")
.Columns(columns =>
{
columns.Bound(o => o.Email);
columns.Bound(o => o.Company);
columns.Bound(o => o.FirstName);
columns.Bound(o => o.LastName);
columns.Bound(o => o.Address1);
columns.Bound(o => o.Address2);
columns.Bound(o => o.City);
columns.Bound(o => o.State);
columns.Bound(o => o.Zip);
columns.Bound(o => o.HomePhone);
columns.Bound(o => o.CellPhone);
columns.Bound(o => o.Website);
columns.Bound(o => o.IMAddress);
columns.Bound(o => o.CreatedDate).Format("{0:MM/dd/yyyy}");
columns.Bound(o => o.UpdatedDate).Format("{0:MM/dd/yyyy}");
}).DataBinding(dataBinding => dataBinding.Ajax().Select("Index", "Customer"))
.Pageable()
.Sortable()
.Scrollable()
.Resizable(resizing => resizing.Columns(true))
.Filterable())
</table>