title: how to solve Attempted to access an element as a type incompatible with the array
body: <p>I am attempting to use <a href="http://www.codeproject.com/Tips/597253/Using-the-Grid-MVC-in-ASP-NET-MVC" rel="nofollow">Grid.MVC</a> in my code. The example seems simple enough but when I try to use it I keep getting an <code>ArrayTypeMismatchException</code>.</p>
  
  <p>This is my code. Any ideas on how i can solve it?</p>
  
  <pre><code>//This is the my cshtml code.
  
   @Html.Grid(Model).Columns(columns =&gt; 
      {
          columns.Add(c =&gt; c.Name).Titled("Name");
          columns.Add(c =&gt; c.Operation).Titled("Operation").Filterable(true);
      }).WithPaging(3).Sortable(true)
  
  
  
  //This is my controller code.
  
  public ActionResult ListAllAuthorization()
  {
      IList&lt;AuthorizationWrapper&gt; authorizations;
      using (GenericRepositoryV2 repo = new GenericRepositoryV2())
      {
          authorizations = repo.GetAllAuthorization();
  
      }
      return View(authorizations);
  }
  </code></pre>
  
  <p>If it makes a difference, my configuration:</p>
  
  <ul>
  <li>MVC 5</li>
  <li>.Net framework 4.5</li>
  </ul>
  
  <p><strong>Update 1:</strong> The stack trace:</p>
  
  <pre><code>at System.Collections.Generic.List`1.set_Item(Int32 index, T value)
  at System.Collections.ObjectModel.Collection`1.SetItem(Int32 index, T item)
  at System.Web.Routing.RouteCollection.SetItem(Int32 index, RouteBase item)
  at System.Collections.ObjectModel.Collection`1.set_Item(Int32 index, T value)
  at System.Web.Mvc.ControllerContext.get_RequestContext()
  at GridMvc.Html.GridHtmlOptions`1.RenderPartialViewToString(String viewName, Object model, ViewContext viewContext)
  at GridMvc.Html.GridHtmlOptions`1.ToHtmlString()
  at System.Web.HttpUtility.HtmlEncode(Object value)
  at System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, Object content)
  at System.Web.WebPages.WebPageBase.Write(Object value)
  at ASP._Page_Views_Admin_ListAllAuthorization_cshtml.Execute() in e:\Oman-Erp\OmanERP\Views\Admin\ListAllAuthorization.cshtml:line 28
  at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
  at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
  at System.Web.WebPages.StartPage.RunPage()
  at System.Web.WebPages.StartPage.ExecutePageHierarchy()
  at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
  at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
  at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
  at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
  </code></pre>