All grids for MVC 19.1 throws exception in this row for HttpPost. HttpGet works correct. It also worked in MVC 17.2. How I can fix or debug JSON content for grids/datasets?
@(Html.Infragistics().Grid(Model))
JsonReaderException: Unexpected character encountered while parsing value: _. Path '', line 0, position 0.] Newtonsoft.Json.JsonTextReader.ParseValue() +1111 Newtonsoft.Json.JsonTextReader.Read() +26 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) +94 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) +689 Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) +469 Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) +145 Newtonsoft.Json.JsonConvert.DeserializeObject(String value, JsonSerializerSettings settings) +53 Infragistics.Web.Mvc.GridModel.DataBindInternal() +1203 Infragistics.Web.Mvc.GridModel.DataBind() +45 Infragistics.Web.Mvc.InfragisticsSuite`1.SetupGrid(IGridModel gridViewModel) +53 ASP._Page_Views_Item_List_cshtml.Execute() in d:\TFS\Cyberbahn\Development\Net\Mdo\Intranet\Views\Item\List.cshtml:151 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147 System.Web.WebPages.StartPage.ExecutePageHierarchy() +86 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +104 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +31 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +187 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +27 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +41 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously
Hello Yuri,
Thank you for posting in our forum.
This error usually gets thrown when you try to deserialize something that is not a valid JSON, or not JSON at all – a similar issue is discussed in this StackOverflow thread.
I would suggest that you try the two online tools that the answer there suggests: one is for validating the JSON and the other one - to generate C# from it.
Some additional information with regard to your scenario would be much appreciated:
I look forward to hearing from you.
It is error scenario for one grid. I have MVC4 controller and view:
- The action is ActionResult List(CustomerSearchModel search). The CustomerSearchModel extends GridModel
- The controller creates DataSource for grid model. It is DataSet with DataTable
search.DataSource = <data set> search.DataMember = <table name>;
- The view create form with @using (Html.BeginForm("List", "Customer", FormMethod.Post)). The form has grid and other buttons and fields.
- The form has Refresh button that refresh full form and grid (posting on the current action). $('#btnRefresh').click(function (e) { $('#spinner').show(); $(this).closest('form')[0].submit(); });
- The model has some features. See below.
- The posting has internal JSON error in grid model when I create grid with new data after click on the Refresh button. Can I disable internal JSON deserialization for the grid?Infragistics.Web.Mvc.GridModel.DataBindInternal()