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

[Solved] Grid always does the server binding although configured to do ajax

0 Answers 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
iggy
Top achievements
Rank 1
iggy asked on 19 Sep 2011, 10:47 PM
I have the following view:

    @(
        Html.Telerik().Grid(Model)
                .Name("List")
                .Columns(columns =>
                {
                    columns.Bound(a => a.Name);
                    columns.Bound(a => a.description);
                    columns.Bound(a => a.BusinessName);
                    columns.Bound(a => a.Phone);
                    columns.Bound(a => a.Notes);
                    columns.Bound(a => a.IsActive);
                })
                .DataBinding(d =>
                    {
                        d.Ajax().Select("_Grid", "Mvc");
                    })
                .EnableCustomBinding(true)
                .Pageable(paging => paging.Total((int)ViewBag.Total).PageSize((int)ViewBag.PageSize))
)
 
            </td>



The controller looks like this:

public ActionResult Grid()
{
    int iTotalRows = 0;
                Cnt sc = GetSession();
    IEnumerable<ListRecord> data = _GetData(1, ref iTotalRows);
 
    ViewBag.Total = iTotalRows;
    ViewBag.PageSize = sc.PagingSize;
    return View(data);
}
 
[GridAction(ActionParameterName = "command", EnableCustomBinding = true)]
public ActionResult _Grid(GridCommand command)
{
    int iTotalRows = 0;
    int iPageNumber = command.Page;
                 Cnt sc = GetSession();
    IEnumerable<ListRecord> data = _GetData(iPageNumber, ref iTotalRows);
 
    ViewBag.PageSize = sc.PagingSize;
    return View(new GridModel(data) {Total = iTotalRows});
}


When I go from one page to the other, the grid always does a server side binding (no XHR requests in firebug)

Any thoughts?
Tags
General Discussions
Asked by
iggy
Top achievements
Rank 1
Share this question
or