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

Grid Paging and Filtering not occuring

2 Answers 87 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.
Jatin
Top achievements
Rank 1
Jatin asked on 26 Jul 2011, 03:40 PM
Hi,
   I am trying to use custom ajax binding for paging and filtering Telerik Q2 Grid. The problem is that the Action method (Select) for ajax paging and Filtering gets called but the GridCommand object doesn't reflect the values properly. For Paging I have set PageSize to 1 , but I always receive PageSize = 10 in GridCommand object. For Filtering, the Filters count is 0. So neither paging nor filtering is taking place. Please help me resolve this problem. Here is the code.

<!-- The View -->
 
@(Html.Telerik().Grid(Model)
                .Name("UserGrid")
                .DataBinding(dataBinding => dataBinding.Ajax().Select("_UserList", "User"))
                .Filterable()
                .Pageable(settings => {
                    settings.PageSize(1);
                    settings.Total((int)ViewData["count"]);
                })
                .EnableCustomBinding(true)
 
                .Columns(col => {
                    col.Bound(m => m.Id).Width(100);
......
}

// The Controller Ajax Action
 
        [GridAction(EnableCustomBinding=true)]
        public ActionResult _UserList(GridCommand command) { //GridCommand not properly constructed
            List<User> users = GetListData(command);
            return View(new GridModel { Data = users, Total = count });
        }

regards,
Nirvan.

2 Answers, 1 is accepted

Sort by
0
Jatin
Top achievements
Rank 1
answered on 28 Jul 2011, 04:11 AM
Hi,
   I used "Glimpse MVC" and found that the ajax method _UserList() returned 500 Internal Server Error. I searched for web for the error in relation to Telerik MVC grid and came accross this article ( http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-troubleshooting.html#ServerError ). So, I downloaded the Fiddler utility to view the stack trace and found that the "return View(new GridModel())" was looking for the view _UserList, which was strange as the  request is an ajax request. Here is the summary of the stack trace.

[InvalidOperationException]: The view &#39;_UserList&#39; or its master was not found or no view engine supports the searched locations.   

So the main point is Why is the View(new GridModel()) looking for a view, when it is supposed to return JSON or something ajaxical. Is it some mistake on my part ?

regards,
Nirvan.
0
Jatin
Top achievements
Rank 1
answered on 28 Jul 2011, 12:37 PM
Hi All,
One more thing that I wanted to add is that even if I remove custom ajax binding and use normal ajax binding, I still get the same error. I am pasting complete stack trace for the ajax request (using normal ajax binding). As you can see, its looking to render a view for a ajax request !  I am really stuck at this one, please help. Here is the stack trace.

[InvalidOperationException]: The view '_UserList' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/User/_UserList.aspx
~/Views/User/_UserList.ascx
~/Views/Shared/_UserList.aspx
~/Views/Shared/_UserList.ascx
~/Views/User/_UserList.cshtml
~/Views/User/_UserList.vbhtml
~/Views/Shared/_UserList.cshtml
~/Views/Shared/_UserList.vbhtml
   at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
   at Castle.Proxies.ControllerActionInvokerProxy.InvokeActionResult_callback(ControllerContext controllerContext, ActionResult actionResult)
   at Castle.Proxies.Invocations.ControllerActionInvoker_InvokeActionResult.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Glimpse.Mvc3.Interceptor.InvokeActionResultInterceptor.Intercept(IInvocation invocation)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.ControllerActionInvokerProxy.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
   at System.Web.Mvc.Controller.ExecuteCore()
   at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
   at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
   at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->


regards,
Nirvan.
Tags
Grid
Asked by
Jatin
Top achievements
Rank 1
Answers by
Jatin
Top achievements
Rank 1
Share this question
or