问题
I have a button
on a .aspx
page which opens the popup
to upload images
of selected item.
ListEdit.aspx
<asp:Button ID="btnListingImageUpload" runat="server" Text="Upload Images"
OnClientClick="basicPopup()"/>
Javascript:
function basicPopup() {
var QuoteId = document.getElementById('<%= hdnQuoteIDForListing.ClientID%>').value;
var IsPrep = document.getElementById('<%= hdnIsPrep.ClientID%>').value;
alert(IsPrep);
popupWindow = window.showModalDialog('ListingImageUpload.aspx?QuoteID=' + QuoteId + '&IsPrep=' + IsPrep, 'popUpWindow', 'height=400,width=600,left=200,top=250,resizable=0');
return false;
}
AjaxFileUpload Control on Popup Page:
<cc1:AjaxFileUpload ID="AjaxFileUpload2" ThrobberID="myThrobber" ContextKeys="fred" AllowedFileTypes="jpg,jpeg" MaximumNumberOfFiles="10" runat="server" OnUploadComplete="AjaxFileUpload1_UploadComplete1"
OnClientUploadComplete="onClientUploadCompleteFront" />
When i click
on button
it opens the page
as popup containing AJAXFileUpload
control and querystring
in popup page. When i click on 'Upload' button of popup page containing AjaxFileUpload
control it gives following error:
JavaScript runtime error: Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.
Parameter name: data
But, when is use session instead of querystring it works fine!
I have googled and found this link but i am not able to resolve it. I have AJAXControlToolKit.dll
(only)in bin folder
and not the source files and other binaries.
NOTE: Please suggest solution using querystring
only. Reason is, multiple instances of this popup will open at time. So, cant use Session
variables.
Help Appreciated!
回答1:
You can decompile de .dll with some App like Telerik, and then apply changes on the code and recompile.
回答2:
This is a known issue, when AjaxFileUpload post back it takes your page URL and appends onto the end of it it's own.query strings (contextkey and guid). This works fine if your page URL doesn't already contain any query strings but if it does then you end up with a URL that contains two question marks which will corrupt your final query string value and this in turn stops the upload from working.
Check this Known Issue
来源:https://stackoverflow.com/questions/29203310/ajaxfileupload-control-doesnt-work-when-page-have-querystring-in-asp-net