This question is locked. New answers and comments are not allowed.
I'm having a problem where I'm trying to make my grid use AJAX to handle paging and sorting. Every time I page or sort, the grid uses the server binding, doing a full postback. I'm sure I'm missing something simple here, but I can't figure out what it is. Here's my code:
And the controller:
Any help is greatly appreciated.
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>Index</
title
>
<%= Html.Telerik().StyleSheetRegistrar().DefaultGroup(group=> group
.Add("site.css")
.Add("telerik.common.css")
.Add("telerik.office2007.css"))
%>
</
head
>
<
body
>
<
div
style="width: 950px; margin-left: auto; margin-right: auto; min-height: 1000px;
background-color: White;">
<% using (Html.BeginForm())
{ %>
<
div
style
=
"padding-left: 10px; padding-right: 10px; padding-top: 20px;"
>
<%= Html.Telerik().Grid<
TestMvcApplication.DAL.sprocGVGetCaseLoad_Result
>("searchResults")
.Name("searchResultsGrid").Pageable(t => t.PageSize(50))
.DataKeys(dataKeys => dataKeys.Add("CaseReviewID"))
.Columns(columns =>
{
columns.Bound(typeof(int), "CaseReviewID").Visible(false);
columns.Bound(typeof(string), "Pilot");
columns.Bound(typeof(string), "Name");
columns.Bound(typeof(string), "SSN");
columns.Bound(typeof(string), "DueDate30Day").Title("Due Date (30)");
columns.Bound(typeof(string), "DueDate").Title("Due Date (45)");
columns.Bound(typeof(string), "CatType").Title("Cat/Type");
columns.Bound(typeof(string), "QCReviewer");
columns.Bound(typeof(string), "ReviewStatus");
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("AjaxGrid", "Home"))
.Sortable()
.Scrollable(scrolling => scrolling.Height(400))
%>
</
div
>
<% } %>
</
div
>
</
body
>
</
html
>
And the controller:
public class HomeController : Controller
{
public ActionResult Index(string id)
{
ViewData["searchResults"] = new MEQCEntities().sprocGVGetCaseLoad("0", "0", "1").ToList();
return View();
}
[GridAction]
public ActionResult AjaxGrid()
{
return View(new GridModel(new MEQCEntities().sprocGVGetCaseLoad("0", "0", "1").ToList()));
}
}
Any help is greatly appreciated.