This is a migrated thread and some comments may be shown as answers.

AJAX Binding being ignored

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dickie
Top achievements
Rank 1
Dickie asked on 03 May 2011, 04:04 PM
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:

<%@ 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">
<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.

1 Answer, 1 is accepted

Sort by
0
Dickie
Top achievements
Rank 1
answered on 04 May 2011, 07:56 PM
Nevermind, I was missing my ScriptRegistrar.
Tags
Grid
Asked by
Dickie
Top achievements
Rank 1
Answers by
Dickie
Top achievements
Rank 1
Share this question
or