title: MVC posting IPagedList
body: <p>I have the following PagedListModel: </p>
  
  <pre><code>public class PagedClientViewModel
  {
      public int? Page { get; set; }
      public PagedList.IPagedList&lt;ClientViewModel&gt; Clients { get; set; }               
  }
  
  public class ClientViewModel
  {        
      public string ClientNumber { get; set; }
      public bool UseThisClient{ get; set; }
  }
  </code></pre>
  
  <p>My view looks like this:</p>
  
  <pre><code>@using (Html.BeginForm("Index", "Home", FormMethod.Get, new { id = "Form" }))
  {
      @foreach (var item in Model.Clients)
      {
         @Html.DisplayFor(modelItem =&gt; item.ClientNumber)
         @Html.CheckBoxFor(modelItem =&gt; item.UseThisClient)
      }    
  
   @Html.HiddenFor(model =&gt; model.Clients)            
  }
  </code></pre>
  
  <p>Controller Action: </p>
  
  <pre><code> public ActionResult Index(PagedClientViewModel model)
   {
    //...process all clients in the list
   }
  </code></pre>
  
  <p>I want to post the model back to the controller so that I can process which checkboxes have been ticked, but I get the following error: I kind of understand that the error is because I'm posting back an interface but I cant find a way around that. How can I get this work?</p>
  
  <blockquote>
    <p>Cannot create an instance of an interface.     at
    System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
    publicOnly, Boolean noCheck, Boolean&amp; canBeCached,
    RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck)     at
    System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
    skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)     at
    System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
    Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)<br>
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)<br>
    at System.Activator.CreateInstance(Type type)     at
    System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext
    controllerContext, ModelBindingContext bindingContext, Type modelType)
    at System.Web.Mvc.DefaultModelBinder.BindSimpleModel(ControllerContext
    controllerContext, ModelBindingContext bindingContext,
    ValueProviderResult valueProviderResult)     at
    System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext
    controllerContext, ModelBindingContext bindingContext)     at
    System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext
    controllerContext, ModelBindingContext bindingContext,
    PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder)<br>
    at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext
    controllerContext, ModelBindingContext bindingContext,
    PropertyDescriptor propertyDescriptor)     at
    System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext
    controllerContext, ModelBindingContext bindingContext)     at
    System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext
    controllerContext, ModelBindingContext bindingContext, Object model)<br>
    at
    System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext
    controllerContext, ModelBindingContext bindingContext)     at
    System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext
    controllerContext, ModelBindingContext bindingContext)     at
    System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext
    controllerContext, ParameterDescriptor parameterDescriptor)     at
    System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext
    controllerContext, ActionDescriptor actionDescriptor)     at
    System.Web.Mvc.Async.AsyncControllerActionInvoker.&lt;>c_<em>DisplayClass25.b</em>_1e(AsyncCallback
    asyncCallback, Object asyncState)     at
    System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult<code>1.Begin(AsyncCallback
    callback, Object state, Int32 timeout)     at
    System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext
    controllerContext, String actionName, AsyncCallback callback, Object
    state)     at
    System.Web.Mvc.Controller.&lt;&gt;c__DisplayClass1d.&lt;BeginExecuteCore&gt;b__17(AsyncCallback
    asyncCallback, Object asyncState)     at
    System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult</code>1.Begin(AsyncCallback
    callback, Object state, Int32 timeout)     at
    System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback,
    Object state)     at
    System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult<code>1.Begin(AsyncCallback
    callback, Object state, Int32 timeout)     at
    System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext,
    AsyncCallback callback, Object state)     at
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext
    requestContext, AsyncCallback callback, Object state)     at
    System.Web.Mvc.MvcHandler.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__2(AsyncCallback
    asyncCallback, Object asyncState)     at
    System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult</code>1.Begin(AsyncCallback
    callback, Object state, Int32 timeout)     at
    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase
    httpContext, AsyncCallback callback, Object state)     at
    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext,
    AsyncCallback callback, Object state)     at
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext
    context, AsyncCallback cb, Object extraData)     at
    System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    Boolean&amp; completedSynchronously)</p>
  </blockquote>