0

I am working on an asp.net mvc5.2.2. web application, and i have the following code inside my view:-

@Html.Action("Index", "Skill")

which will call the following Action method:-

public async Task<ActionResult> Index(string filter = null, int page = 1, int pageSize = 20, string sort = "Name", string sortdir = "DESC")
        {


            var records = new PagedList<Skill>();
            ViewBag.filter = filter;
            records.Content = await skillRepository.GetSkillForGrid(filter, page, pageSize, sort, sortdir).Where(a =>  a.IsActive).ToListAsync();


            // Count
            records.TotalRecords = skillRepository.GetSkillForGridCount(filter, true);

            records.CurrentPage = page;
            records.PageSize = pageSize;

            return View(records);
        }

but i will get the following error on the view:-

HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete.

Source Error:

Line 172: Line 173: Line 174:@Html.Action("Index", "Skill") Line 175:

Line 176:
@Html.ActionLink("Edit", "Edit", new { id = Model.StaffID }) |

John John
  • 1
  • 72
  • 238
  • 501
  • does it work you don't use mvc grid helper – qamar Jan 22 '15 at 03:03
  • @qamar now i modify my Html.Action to call an action method that return a simple html table instead of WebGrid but unfortunately i got the same error,, could this be that the Html.Action is calling async action method!!? – John John Jan 22 '15 at 03:09
  • As per some researc Html.Action click considered as child action which is supported in aysnc mode. https://aspnetwebstack.codeplex.com/workitem/601 – qamar Jan 22 '15 at 03:12

0 Answers0