This question is locked. New answers and comments are not allowed.
We have a grid which work fine when inserting stuff but once saved has a different behavior.
When we are editing an existing element in the grid, an Ajax is created to the server but the server crash with the exception:
The grid use Ajax Binding:
Why do I have a
Thank you
When we are editing an existing element in the grid, an Ajax is created to the server but the server crash with the exception:
<
br
>System.MissingMethodException: No parameterless constructor defined for this object.<
br
> at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)<
br
> at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)<
br
> at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)<
br
> at System.Activator.CreateInstance(Type type, Boolean nonPublic)<
br
> at System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)<
br
> at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> 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)<
br
> at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model)<
br
> at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> at System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, Type elementType)<
br
> at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<
br
> at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)<
br
> at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)<
br
> at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)}
The grid use Ajax Binding:
In fact, the UpdateDetailBatchEditing seem to be problematic since it does a call (I can see the XHR call in the debug window) but doesn't look to be able to do its binding on the controller action "UpdateDetailBatchEditing".
.DataBinding(dataBinding =>
dataBinding.Ajax()
.Select("LoadDetailBatchEditing"
,
"Invoice"
,
new
{ itemType = InvoiceDetailType.Service })
.Update("UpdateDetailBatchEditing"
,
"Invoice"
,
new
{ itemType = InvoiceDetailType.Service })<br> )
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public
ActionResult UpdateDetailBatchEditing(
[Bind(Prefix =
"inserted"
)] IEnumerable<InvoiceDetail> insertedDetails,
[Bind(Prefix =
"updated"
)] IEnumerable<InvoiceDetail> updatedDetails,
[Bind(Prefix =
"deleted"
)] IEnumerable<InvoiceDetail> deletedDetails, InvoiceDetailType itemType) {
//...
Why do I have a
System.MissingMethodException: No parameterless constructor defined for this object
Thank you