This question is locked. New answers and comments are not allowed.
Hi,
I am getting the server error 500 when using Ajax binding with the Telerik MVC grid. the actual ajax error is "The view _Index" or its master was not found or no view engine supports the searched locations. the following locations were searched...etc". here is the code. the server binding works, but the ajax binding doesn't work. I spent a long time on this by uninstalling and reinstalling Telerik MVC extensions, but it doesn't work. Is there anyway to find out what is actually causing this to fail? the error is self-explanatory (saying there is no view having the same name as action method, but I think it should still work according to the demos). I spent a long time on this, Please let me know if there is anything else I am missing here. The Telerik controls version is "2011.3.1115"
_Layout.cshtml:
View:
I am getting the server error 500 when using Ajax binding with the Telerik MVC grid. the actual ajax error is "The view _Index" or its master was not found or no view engine supports the searched locations. the following locations were searched...etc". here is the code. the server binding works, but the ajax binding doesn't work. I spent a long time on this by uninstalling and reinstalling Telerik MVC extensions, but it doesn't work. Is there anyway to find out what is actually causing this to fail? the error is self-explanatory (saying there is no view having the same name as action method, but I think it should still work according to the demos). I spent a long time on this, Please let me know if there is anything else I am missing here. The Telerik controls version is "2011.3.1115"
_Layout.cshtml:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script> @(Html.Telerik().StyleSheetRegistrar().DefaultGroup(g => g .Add("telerik.common.css") .Add("telerik.default.css") .Combined(true) .Compress(true) )) </head> <body> @RenderBody() @(Html.Telerik().ScriptRegistrar()) </body> </html>
Controller:
public class HomeController : Controller { public ActionResult Index() { return View(GetCustomers()); } [GridAction] public ActionResult _Index() { return View(new GridModel(GetCustomers())); } public IEnumerable<Customer> GetCustomers() { return new List<Customer> { new Customer {CustomerId = 1, FirstName = "CustFirst1", Surname = "CustLast1"}, new Customer {CustomerId = 2, FirstName = "CustFirst2", Surname = "CustLast1"}, new Customer {CustomerId = 3, FirstName = "CustFirst3", Surname = "CustLast1"}, new Customer {CustomerId = 4, FirstName = "CustFirst4", Surname = "CustLast1"}, new Customer {CustomerId = 5, FirstName = "CustFirst5", Surname = "CustLast1"}, new Customer {CustomerId = 6, FirstName = "CustFirst6", Surname = "CustLast1"}, new Customer {CustomerId = 7, FirstName = "CustFirst7", Surname = "CustLast1"}, new Customer {CustomerId = 8, FirstName = "CustFirst8", Surname = "CustLast1"}, new Customer {CustomerId = 9, FirstName = "CustFirst9", Surname = "CustLast1"}, new Customer {CustomerId = 10, FirstName = "CustFirst10", Surname = "CustLast1"}, new Customer {CustomerId = 11, FirstName = "CustFirst11", Surname = "CustLast1"}, new Customer {CustomerId = 12, FirstName = "CustFirst12", Surname = "CustLast1"}, new Customer {CustomerId = 13, FirstName = "CustFirst13", Surname = "CustLast1"}, new Customer {CustomerId = 14, FirstName = "CustFirst14", Surname = "CustLast1"}, }; } } public class Customer { public int CustomerId { get; set; } public string FirstName { get; set; } public string Surname { get; set; } }@model IEnumerable<MvcApplication1.Controllers.Customer> @{ ViewBag.Title = "Index"; } @(Html.Telerik().Grid(Model) .Name("Home") .Columns(columns => { columns.Bound(c => c.CustomerId); columns.Bound(c => c.FirstName); }) .DataBinding(dataBinding => { dataBinding.Ajax().Select("_Index", "Home"); }) .Scrollable(scrolling => scrolling.Enabled(true)) .Sortable(sorting => sorting.Enabled(true)) .Pageable(paging => paging.Enabled(true)) .Filterable(filtering => filtering.Enabled(true)) .Groupable(grouping => grouping.Enabled(true)) .ClientEvents(c => c.OnError("onError")) ) <script type="text/javascript"> function onError(e) { alert(e.XMLHttpRequest.responseText); } </script>