This question is locked. New answers and comments are not allowed.
Hi everybody.
I'm trying to do an ajax bind to an entity that comes from a genericrepository that i created. after trying with the direct binding I tried the ajaxcustombinding but neither one of them works.
when I bind the data at the load of the page in the index the data are bound
public ViewResult Index(int? SelectedDepartment) { IEnumerable data = Getcourses(); return View(data); } private IEnumerable Getcourses() { var mo = unitOfWork.CourseRepository.Get( orderBy: q => q.OrderBy(d => d.CourseID), includeProperties: "Department"); return mo; }but when I change my page this way the data are not bound to the grid
public ViewResult Index(int? SelectedDepartment) { return View(); } [GridAction(EnableCustomBinding = true)] public ActionResult _AjaxBinding(GridCommand command) { IEnumerable data = Getcourses(); return View(new GridModel { Data = data}); } private IEnumerable Getcourses() { var mo = unitOfWork.CourseRepository.Get( orderBy: q => q.OrderByDescending(d => d.CourseID), includeProperties: "Department"); return mo; }on the index.cshtml i have always this code this code
@model IEnumerable<ContosoUniversity.Models.Course> @(Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding", "Course")) .Columns(columns => { columns.Bound(o => o.CourseID).Width(50); columns.Bound(o => o.Title).Width(100); columns.Bound(o => o.Credits).Width(200); }) .EnableCustomBinding(true) .Sortable() .Groupable() )I don't understand if the problem is just because i get type of entity from the generic repository
System.Data.Entity.DynamicProxies.Course_5E43C6C196972BF0754973E48C9C941092D86818CD94005E9A759B70BF6E48E6
can somebody explain me what i'm doing wrong? thank you very much
raphael