This question is locked. New answers and comments are not allowed.
This is my view:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Items</h2>
<%= Html.Telerik().Grid<Template.Data.Item>()
.Name("ItemsGrid")
.DataBinding(binding => binding.Ajax().Select("GetGridSource", "Articole"))
.Columns(columns=>
{
columns.Bound(l => l.Id);
columns.Bound(l => l.Name);
})
.Selectable()
.Scrollable(x=>x.Enabled(true))
.EnableCustomBinding(true)
.Pageable(paging => paging.Total((int)ViewData["ItemsCount"]))
%>
</asp:Content>
This is the controller , that works fine
public class ArticoleController : Controller
{
public ActionResult Index()
{
ViewData["ItemsCount"] = 1;
return View();
}
[GridAction(EnableCustomBinding = true)]
public ActionResult GetGridSource(GridCommand command)
{
IEnumerable<Item> data = new List<Item>
{
new Item{ Id=1,Name="name"}
};
return View(new GridModel(data)
{
Total = 1
});
}
}
This is the controller that doesn't work:
public class ArticoleController : Controller
{
public ActionResult Index()
{
ViewData["ItemsCount"] = 1;
return View();
}
[GridAction(EnableCustomBinding = true)]
public ActionResult GetGridSource(GridCommand command)
{
IEnumerable<Item> data = new List<Item>
{
new Item{ Id=1,Name="name", Location=new Location{Name="location name"}}
};
return View(new GridModel(data)
{
Total = 1
});
}
}
In this case i get "The requested URL returned 500".
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Items</h2>
<%= Html.Telerik().Grid<Template.Data.Item>()
.Name("ItemsGrid")
.DataBinding(binding => binding.Ajax().Select("GetGridSource", "Articole"))
.Columns(columns=>
{
columns.Bound(l => l.Id);
columns.Bound(l => l.Name);
})
.Selectable()
.Scrollable(x=>x.Enabled(true))
.EnableCustomBinding(true)
.Pageable(paging => paging.Total((int)ViewData["ItemsCount"]))
%>
</asp:Content>
This is the controller , that works fine
public class ArticoleController : Controller
{
public ActionResult Index()
{
ViewData["ItemsCount"] = 1;
return View();
}
[GridAction(EnableCustomBinding = true)]
public ActionResult GetGridSource(GridCommand command)
{
IEnumerable<Item> data = new List<Item>
{
new Item{ Id=1,Name="name"}
};
return View(new GridModel(data)
{
Total = 1
});
}
}
This is the controller that doesn't work:
public class ArticoleController : Controller
{
public ActionResult Index()
{
ViewData["ItemsCount"] = 1;
return View();
}
[GridAction(EnableCustomBinding = true)]
public ActionResult GetGridSource(GridCommand command)
{
IEnumerable<Item> data = new List<Item>
{
new Item{ Id=1,Name="name", Location=new Location{Name="location name"}}
};
return View(new GridModel(data)
{
Total = 1
});
}
}
In this case i get "The requested URL returned 500".