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

[Solved] Ajax databinding controller action sometimes can't find view on occasion?

1 Answer 90 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.
Levi
Top achievements
Rank 1
Levi asked on 02 Nov 2011, 05:18 PM
Forgive this post if it's a duplicate somewhere, but I can't find much on the issue.

I have a standard Ajax data binding for an MVC Grid, similar to the example at http://demos.telerik.com/aspnet-mvc/grid/ajaxbinding

My action looks like:

[GridAction]
 public override ActionResult DeliverablesData(Guid sceneId, Guid? deliverableId)
 {
     var deliverables = ...;
 
     return View(new GridModel(deliverables));
 }

This works with no problems most of the time. On occasion though, more so when the page has been sitting idle for a while, I get the following exception when a request for data binding is made:

System.InvalidOperationException: The view 'DeliverablesData' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Deliverables/DeliverablesData.aspx
~/Views/Deliverables/DeliverablesData.ascx
~/Views/Shared/DeliverablesData.aspx
~/Views/Shared/DeliverablesData.ascx
   at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   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.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass27.<BeginInvokeAction>b__24(IAsyncResult asyncResult)
   at System.Web.Mvc.AsyncController.<>c__DisplayClass19.<BeginExecuteCore>b__14(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.AsyncController.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.AsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__4(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

It appears to be looking for the view associated with this action. However, there is no view for this action because of the nature of the GridAction. In the demo there doesn't appear to be a view for the action, nor when it does work properly does it try to get the view. Why would this be happening and/or what precautions should I take to ensure this doesn't keep happening.

The way the action is setup by Telerik's example does seem to make me scratch my head because by the mere fact that it's returning a view with a model (return View(model)), that it SHOULD be looking for a view all the time. I assume there's some magic involved, probably in the GridAction attribute that overrides the standard behavior. If that's the case, there appears to be some condition that falls back to the default behavior, but I'm not aware of what could do that.

Any help with this would be fantastic, thanks!

1 Answer, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 20 Dec 2011, 08:00 AM
Curious about this too, wonder why no response yet?  I'm getting 500 status code alerts from telerik when there are modelstate errors in the process of databinding (this is a search form with required fields).
Tags
Grid
Asked by
Levi
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
Share this question
or