title: KendoUI grid does not fire saveChanges event ( System.MissingMethodException: Cannot create an instance of an interface.)
body: <p>KendoUI grid does not fire SaveChanges event.
  I did not see any problem in Environment of Visual Studio 2013 and browsers(FF, IE, Chrome) when I run the project and clicked on SaveChanges button but SaveChanges event does not fire.
  For further investigation, I've used debugger of Chrome and I saw a problem. Please see the pictures of problem, error log and codes.
  (I've used JQuery v1.10)
  Please help me to solve it.</p>
  
  <p><strong><em>EDITED:</em></strong></p>
  
  <p><strong>I understood that error has related with <code>[Bind(Prefix = "models")]</code>.When I removed it,</strong> <strong><code>Editing_Update</code> action be fired but <code>articles</code> object was null. How can I fix it?</strong></p>
  
  <pre><code>Server Error in '/' Application.
  
  Cannot create an instance of an interface.
  
  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.MissingMethodException: Cannot create an instance of an interface.
  
  Source Error: 
  
  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
  
  Stack Trace: 
  
  [MissingMethodException: Cannot create an instance of an interface.]   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck) +0   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) +113   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) +232   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83   System.Activator.CreateInstance(Type type) +66   System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) +460   System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +1137   System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +633   System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, Type elementType) +555   System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +2486   System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +633   System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +495   System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +199   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1e.&lt;BeginInvokeAction&gt;b__16(AsyncCallback asyncCallback, Object asyncState) +1680   System.Web.Mvc.Async.WrappedAsyncResult`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +59   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +94   System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +525   System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +82   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object callbackState, BeginInvokeDelegate`1 beginDelegate, EndInvokeVoidDelegate`1 endDelegate, TState invokeState, Object tag, Int32 timeout, SynchronizationContext callbackSyncContext) +105   System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +595   System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +47   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +65   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object callbackState, BeginInvokeDelegate`1 beginDelegate, EndInvokeVoidDelegate`1 endDelegate, TState invokeState, Object tag, Int32 timeout, SynchronizationContext callbackSyncContext) +139   System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +484   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +50   System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__3(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +98   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object callbackState, BeginInvokeDelegate`1 beginDelegate, EndInvokeVoidDelegate`1 endDelegate, TState invokeState, Object tag, Int32 timeout, SynchronizationContext callbackSyncContext) +106   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +446   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +88   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +50   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/bxMVC.jpg" alt="First Picture of Problem"></p>
  
  <p><img src="https://i.stack.imgur.com/KoWml.jpg" alt="Second Picture of Problem"></p>
  
  <p><strong>A part of my Controller:</strong></p>
  
  <pre><code>[Authorize(Roles = "Administrator")]
      public class ArticleAdminController : MVCController
      {
      private JahanBlogDbContext db = DataContextFactory.GetDataContext();
      private readonly IArticleRepository _articleAdminRepository;
      public ArticleAdminController(IArticleRepository articleRepository)
      {
          _articleAdminRepository = articleRepository;
      }
  
      public ArticleAdminController()
          : this(new ArticleRepository())
      {
      }
  
      // GET: ArticleAdmin
      public ActionResult Index([DataSourceRequest] DataSourceRequest request)
      {
          IEnumerable&lt;ArticleViewModel&gt; instance = new ArticleViewModel().FindByCriteria();
          return View(instance);
      }
  
      public ActionResult Editing_Read([DataSourceRequest] DataSourceRequest request)
      {
          List&lt;ArticleViewModel&gt; instance = new ArticleViewModel().FindByCriteria().ToList();
          DataSourceResult dsRequest = instance.ToDataSourceResult(request);
          return Json(dsRequest, JsonRequestBehavior.AllowGet);
      }
  
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable&lt;ArticleViewModel&gt; articles)
      {
          if (articles != null &amp;&amp; ModelState.IsValid)
          {
              using (new EFUnitOfWorkFactory().Create())
              {
                  foreach (ArticleViewModel articleViewModel in articles)
                  {
                      var art = new Article
                      {
                          Id = articleViewModel.Id,
                          IsActive = articleViewModel.IsActive,
                          IsActiveNewComment = articleViewModel.IsActiveNewComment,
                          Title = articleViewModel.Title,
                      };
                      _articleAdminRepository.Update(art);
                  }
              }
          }
          DataSourceResult result = articles.ToDataSourceResult(request, ModelState);
          return Json(result);
  
      }
     // ....
    }
  </code></pre>
  
  <p>According to above code, when I click the SaveChanges button, Editing_Update must be fire but did not happen!!</p>
  
  <p><strong>My Grid:</strong></p>
  
  <pre><code>@using Jahan.Blog.ViewModel
  @using Kendo.Mvc.UI
  @using Jahan.Blog.Web.Mvc.HtmlHelpers
  @using Kendo.Mvc.UI.Fluent
  @model IEnumerable&lt;ArticleViewModel&gt;
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  &lt;div style="width: 100%;"&gt;
      @(Html.Kendo().Grid&lt;Jahan.Blog.ViewModel.ArticleViewModel&gt;()
            .Name("ArticleAdmin").Navigatable()
            .Resizable(c =&gt; c.Columns(true))
            .HtmlAttributes(new { @class = "cursorLink", @style = "width: 1600px;height:auto;overflow: scroll;" })
            .Columns(columns =&gt;
            {
                columns.Template(x =&gt; { }).ClientTemplate("&lt;a href='" + Url.Action("Details", "ArticleAdmin") + "/#=Id#'&gt;Details&lt;/a&gt;").Width(60);
                columns.Bound(p =&gt; p.Id).Title("Article Id").Width(75);
                columns.Bound(p =&gt; p.Owner).Title("Writer").Width(70);
                columns.Bound(p =&gt; p.Title).Width(200);
                columns.Bound(p =&gt; p.IsActive).Encoded(false).ClientTemplate("&lt;img src='/Content/#= IsActive ? 'tick.png' : 'cross.png' #''&gt;").Width(80);
                columns.Bound(p =&gt; p.IsActiveNewComment).Encoded(false).ClientTemplate("#= showActivationStatusIcon(IsActiveNewComment) #").Width(170);
                columns.Bound(p =&gt; p.Tags).ClientTemplate("#= ShowTagsInGridView(Tags) #").Width(200);
                columns.Bound(p =&gt; p.NumberOfComments).Title("No. Comments").Width(115);
                columns.Bound(p =&gt; p.LikeCounter).Title("No. Like").Width(70);
                columns.Bound(p =&gt; p.RateCounter).Title("Rate").Width(60);
                columns.Bound(p =&gt; p.CreatedDate).Format("{0:G}").Width(160);
                columns.Bound(p =&gt; p.ModifiedDate).Format("{0:G}").Width(160);
                columns.Command(command =&gt; command.Destroy()).Width(170);
            })
            .ToolBar(toolbar =&gt;
            {
                toolbar.Create();
                toolbar.Save();
            })
            .Editable(editable =&gt; editable.Mode(GridEditMode.InCell))
            .Pageable()
            .Navigatable()
            .Sortable()
            .Scrollable()
            .DataSource(dataSource =&gt; dataSource
                .Ajax()
                .Batch(true)
                .PageSize(10)
                .ServerOperation(false)
                .Events(events =&gt; events.Error("error_handler"))
                .Model(model =&gt;
                {
                    model.Id(p =&gt; p.Id);
                    model.Field(p =&gt; p.Id).Editable(false);
                    model.Field(p =&gt; p.Tags).Editable(false);
                    model.Field(p =&gt; p.Owner).Editable(false);
                    model.Field(p =&gt; p.LikeCounter).Editable(false);
                    model.Field(p =&gt; p.RateCounter).Editable(false);
                    model.Field(p =&gt; p.CreatedDate).Editable(false);
                    model.Field(p =&gt; p.ModifiedDate).Editable(false);
                })
                .Create("Editing_Create", "ArticleAdmin")
                .Read(read =&gt; read.Action("Editing_Read", "ArticleAdmin"))
                .Update(update =&gt; update.Action("Editing_Update", "ArticleAdmin"))
                .Destroy(delete =&gt; delete.Action("Editing_Destroy", "ArticleAdmin"))
            ))
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
      function error_handler(e) {
          if (e.errors) {
              var message = "Errors:\n";
              $.each(e.errors, function (key, value) {
                  if ('errors' in value) {
                      $.each(value.errors, function () {
                          message += this + "\n";
                      });
                  }
              });
              alert(message);
          }
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>My ViewModel:</strong></p>
  
  <pre><code>namespace Jahan.Blog.ViewModel
  {
      public class ArticleViewModel : IArticleViewModel
      {
      public ArticleViewModel()
      {
  
      }
      public virtual int Id { get; set; }
      public virtual int? UserId { get; set; }
  
      public virtual string Title { get; set; }
  
      public virtual string Summary { get; set; }
  
      public virtual string Description { get; set; }
  
      public virtual decimal? RateCounter { get; set; }
  
      public virtual int? LikeCounter { get; set; }
  
      public virtual bool IsActive { get; set; }
  
      public virtual bool IsActiveNewComment { get; set; }
  
      public virtual IList&lt;Comment&gt; Comments { get; set; }
  
      public virtual ISet&lt;Rating&gt; Ratings { get; set; }
  
      public virtual IList&lt;AttachmentFile&gt; AttachmentFiles { get; set; }
  
      public virtual IList&lt;ArticleTag&gt; ArticleTags { get; set; }
  
      public virtual ISet&lt;ArticleLike&gt; ArticleLikes { get; set; }
  
      public virtual DateTime? CreatedDate { get; set; }
  
      public virtual DateTime? ModifiedDate { get; set; }
  
      //[UIHint("_TagsOfArticle")]
      public List&lt;TagGridViewModel&gt; Tags { get; set; }
      public virtual int NumberOfComments { get; set; }
  
      public virtual string Owner { get; set; }
  
      private IQueryable&lt;ArticleViewModel&gt; QueryBuilder()
      {
          ArticleRepository repository = new ArticleRepository();
          IQueryable&lt;ArticleViewModel&gt; query = repository.FindAll().Select(article =&gt; new ArticleViewModel
          {
              Id = article.Id,
              //AttachmentFiles = article.AttachmentFiles.Where(a =&gt; a.ArticleId == article.Id).Distinct().ToList(),
              //Comments = article.Comments.Where(c =&gt; c.ArticleId == article.Id).ToList(),
              CreatedDate = article.CreatedDate,
              Description = article.Description,
              IsActive = article.IsActive,
              IsActiveNewComment = article.IsActiveNewComment,
              LikeCounter = article.LikeCounter,
              ModifiedDate = article.ModifiedDate,
              NumberOfComments = article.Comments.Count(c =&gt; c.ArticleId == article.Id),
              RateCounter = article.RateCounter,
              Summary = article.Summary,
              Title = article.Title,
              UserId = article.UserId,
          });
          return query;
      }
  
      public virtual IQueryable&lt;ArticleViewModel&gt; QueryBuilderByCriteria(Expression&lt;Func&lt;ArticleViewModel, bool&gt;&gt; predicate = null, params Expression&lt;Func&lt;ArticleViewModel, object&gt;&gt;[] includeProperties)
      {
          IQueryable&lt;ArticleViewModel&gt; items = QueryBuilder();
          if (includeProperties != null)
          {
              foreach (Expression&lt;Func&lt;ArticleViewModel, object&gt;&gt; includeProperty in includeProperties)
              {
                  items = items.Include(includeProperty);
              }
          }
          if (predicate != null)
              return items.Where(predicate);
          return items;
      }
  
      public virtual IEnumerable&lt;ArticleViewModel&gt; FindByCriteria(Expression&lt;Func&lt;ArticleViewModel, bool&gt;&gt; predicate = null, params Expression&lt;Func&lt;ArticleViewModel, object&gt;&gt;[] includeProperties)
      {
          List&lt;ArticleViewModel&gt; result = new List&lt;ArticleViewModel&gt;();
          var query = QueryBuilderByCriteria(predicate, includeProperties);
          foreach (var articleViewModel in query)
          {
              articleViewModel.Tags = TagGridViewModel.GetByArticleId(articleViewModel.Id); 
              articleViewModel.Owner = AppUserStore.Instance.FindByIdAsync(int.Parse(articleViewModel.UserId.ToString())).Result.UserName;
              result.Add(articleViewModel);
          }
          return result;
      }
  
      public virtual ArticleViewModel FindByArticleId(int articleId)
      {
          ArticleViewModel result = QueryBuilder().FirstOrDefault(a =&gt; a.Id == articleId);
          return result;
      }
  }
  }
  </code></pre>