We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Value cannot be null. Parameter name: input

I am getting this error after the object is saved -
Value cannot be null. Parameter name: input
 
I am using a generic controller and repository pattern to save the object.
I have verified the collection is not null and contains an item before being passed to the GridActions method.
 
This works fine if I am not using GridEditMode.DialogTemplate for the edit mode.

 

        public virtual ActionResult Save(T theObject)
        {
            var existingObject = Repo.GetByMultipleValues(primaryKeys(theObject));

               
            if (existingObject == null)
            // It must be an insert operation
            {
                Repo.Save(theObject);
            }
            else
            // It must be an update operation
            // Update the existing entity with the new values
            {
                AutoMapper.Mapper.Map(theObject, existingObject);
                Repo.Save(existingObject);
            }
            return GetAllItems().GridActions<T>();
        }

 


4 Replies

JB Jeremy Branham October 12, 2013 06:11 PM UTC

Stack Trace -
 
[ArgumentNullException: Value cannot be null.
Parameter name: input]
   System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) +531395
   System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject(String input) +9
   Syncfusion.Mvc.Grid.GridAction`1.ExecuteGridResult(ControllerContext context) +1176
   Syncfusion.Mvc.Grid.GridActionResultBase`1.ExecuteResult(ControllerContext context) +57
   Syncfusion.Mvc.Grid.GridHtmlActionResult`1.ExecuteResult(ControllerContext context) +38
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +89
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9630364
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


HJ Hariharan J V Syncfusion Team October 14, 2013 09:23 AM UTC

Hi Jeremy Branham,

 

Thanks for using Syncfusion products.

 

We suggest you to return partialview for the BeginEdit and BeginAddNew request type in the server mode(DialogTemplate). Please refer the below code snippets.

 

[HomeController.cs]

[AcceptVerbs(HttpVerbs.Post)]

        public ActionResult Index(PagingParams args, int? OrderID)

        {                 

            RequestType currentRequest = (RequestType)Convert.ToInt32(args.RequestType);

            if (currentRequest == RequestType.BeginEdit)

            {

            EditableOrder ord = (EditableOrder)OrderRepository.Select(OrderID);

            return PartialView("OrderEditorTemplate", ord);

            }

            else if (currentRequest == RequestType.BeginAddNew )

            {

            return PartialView("OrderEditorTemplate", new EditableOrder());

            }

            else

            {

                IEnumerable data = OrderRepository.GetAllRecords();

                return data.GridActions<EditableOrder>();

            }

        }

 

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/DialogTemplate666937353.zip

 

Please let us know if you need any further assistance.

 

Regards,

Hariharan J.V.



JB Jeremy Branham October 16, 2013 03:58 AM UTC

I am returning a partial view in my Index() method.
The error occurs when returning the GridActions() in the Save() method.


AS Alan Sangeeth S Syncfusion Team October 17, 2013 07:18 AM UTC

Hi Jeremy,

Thank You for using Syncfusion Product.

We regret for the inconvenience caused. We are unable to reproduce the issue in our end. The previous sample which we had provided you is running without any error in Save Action and we have created a video demonstration of it. So could you please try to reproduce the issue in our sample and send us back or send your sample so that we can provide you a better solution?

Please find the attached video below.

Please let us know if you need further assistance.

Regards,

Alan Sangeeth S

 



SaveAction_a83e6a06.zip

Loader.
Live Chat Icon For mobile
Up arrow icon