I am facing an issue with my AJAX HtmlEditorExtender, specifically when trying to upload an image. The error message I receive is as follows:
JavaScript runtime error: Sys.ArgumentException: Cannot de-serialize. The data does not correspond to valid JSON. Parameter name: data
After researching the error, some sources suggested that it could be due to passing parameters through the query string. I removed the parameters, but the error persists. Are there any other potential reasons for this problem?
Interestingly, the same Html Editor Extender functions correctly on another page of mine.
Below you can find the HTML and C# code snippets:
<asp:HtmlEditorExtender ID="HtmlEditorExtender3" runat="server" TargetControlID="txtAdminAddNote" OnImageUploadComplete="MyHtmlEditorExtender_ImageUploadComplete">
<Toolbar>
<asp:InsertImage />
</Toolbar>
</asp:HtmlEditorExtender>
<asp:TextBox runat="server" ID="txtAdminAddNote" TextMode="MultiLine" Width="96%" Height="200px"></asp:TextBox>
protected void MyHtmlEditorExtender_ImageUploadComplete(object sender, AjaxFileUploadEventArgs e)
{
string filePath = "~/Images/" + Path.GetFileName(e.FileName);
var ajaxFileUpload = (AjaxFileUpload)sender;
ajaxFileUpload.SaveAs(MapPath(filePath));
e.PostedUrl = Page.ResolveUrl(filePath);
}