This is a migrated thread and some comments may be shown as answers.

GridAttachmentColumn - invalid JSON primitive in upload

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 01 Oct 2010, 10:04 AM
Hi all,

I'm having an odd problem - odd in that it used to work, and I can't identity what's changed to make it no longer work.

I have a user control which contains a multiview, and on one tab there's a RadGrid showing attachments (more-or-less lifted from the example on the Telerik site) and an "add new attachment" button which displays a filename box, browse button and an insert / cancel links... again, just like the example on the telerik site.

When I browse to a file (e.g. dialonly.png) and select it the filename (but not path) is populated in the filename box. I hit "insert" and I get this:

Source: System.Web

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

Stack trace: at System.Web.UI.Page.HandleError(Exception e) 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
at System.Web.UI.Page.ProcessRequest() 
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) 
at System.Web.UI.Page.ProcessRequest(HttpContext context) 
at ASP.trading_customerview_aspx.ProcessRequest(HttpContext context) in c:\Users\Kevin\AppData\Local\Temp\Temporary ASP.NET Files\root\31738672\d2138b1c\App_Web_m5moos4i.12.cs:line 0 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

Inner exception:

Source: System.Web.Extensions

Message: Invalid JSON primitive: dialonly.png.

Stack trace: at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject() 
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) 
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) 
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) 
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input) 
at Telerik.Web.UI.RadUpload.LoadPostData(String postDataKey, NameValueCollection postCollection) 
at Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) 
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)



I'm pretty sure (having been back though subversion logs) that the only thing that's changed since this worked is that we're now using a newer build of the telerik ASP.Net AJAX suite than we were before when it worked. We're not using jQuery or any other library on that page, and nor are the controls embedded in any non-telerik controls. There is a RadAjaxManager and RadScriptManager on the page, and the user controls in question (I have the same problem on all of them) are loaded into a pane of a RadSplitter.

I'm at a bit of a loss as to where to start looking at this - I don't actually know where the JSON stuff is happening in the background, so I'm a bit in the dark as to where to look for more info!

Cheers for any help,

Kev

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 07 Oct 2010, 08:45 AM
Hello Lee,

Are you disabling AJAX when your upload starts? Uploads and downloads should make a full page postback. You can refer to RadGrid Attachment column demo for an example on how to disable AJAX in this scenario. Otherwise, this exception may occur if you have broken HTML in your (unclosed tags, omitted quotes, etc).

Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or