I am getting error after downloading file . It is exporting aspx page content to PPTX.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters,
HttpModules, or server trace is enabled.
Details: Error parsing near 'PK
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(showProgressBar_BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(hideProgressBar_EndRequestHandler);
}
function showProgressBar_BeginRequestHandler(sender, args) {
var show_progbar = false;
var postback_elems = new Array("Button1");
var postback_elem = args.get_postBackElement();
for (var i = 0; i < postback_elems.length; i++) {
if (postback_elem.id.search(postback_elems[i]) != -1) {
show_progbar = true;
break;
}
}
if (show_progbar) {
alert("loading");
}
}
function hideProgressBar_EndRequestHandler(sender, args) {
try
{
if (args.get_error() != undefined) {
}
alert('Finished');
finishDownload();
It is not a good practice to use Response.Write from within an ASP.NET page in general. As UpdatePanels work by intercepting the page rendering process you are recieving the errors.
You can put the code to generate the data in an HTTPHandler or you can make the button a PostBackTrigger.
There are many other possible causes besides Response.Write.
The general idea is that the response should conform to certain format, for instance: "111|updatePanel|UpdatePanel1| .... ", otherwise, the ajax library won't be able to parse it. And an exception is thrown.
You may use Fiddler to view the view the traffic, and you will see what response is returned from the server with the help of it. Then, it'll be easier to find out the real cause.
The error may come when client side script tries to parse the response from the server. The response may be in format, for example XML, JSON, or plain texts. For controls provided by Aspose, you may seek advices at
http://www.aspose.com/community/forums/default.aspx
SharePoint registers a JavaScript "on submit" handler through INIT.js. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since "Download
postback" does not refresh the page this variable remains true.
Hence subsequent button clicks stop working. There is an easy way to work around this issue. Register OnClientClick event for the button click and set _spFormOnSubmitCalled to false.
SharePoint registers a JavaScript "on submit" handler through INIT.js. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since "Download
postback" does not refresh the page this variable remains true.
Hence subsequent button clicks stop working. There is an easy way to work around this issue. Register OnClientClick event for the button click and set _spFormOnSubmitCalled to false.
SharePoint registers a JavaScript "on submit" handler through INIT.js. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since "Download
postback" does not refresh the page this variable remains true.
Hence subsequent button clicks stop working. There is an easy way to work around this issue. Register OnClientClick event for the button click and set _spFormOnSubmitCalled to false.
rakeshbpatel
Member
2 Points
2 Posts
Microsoft JScript runtime error
Feb 16, 2012 01:18 AM|LINK
I am getting error after downloading file . It is exporting aspx page content to PPTX.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near 'PK
ASPX Code :
<asp:ScriptManager ID="scManager" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="aaa" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Downlaod" />
<asp:HiddenField ID="hdnServerControl" runat="server" />
<input type="hidden" id="hdnClientControl" runat="server" />
</ContentTemplate>
<Triggers>
<%--<asp:PostBackTrigger ControlID="Button1" />--%>
</Triggers>
</asp:UpdatePanel>
ASPX Code Behind
string strHttpResCT = "application/vnd.ms-powerpoint";
string strHttpHdrCD = "attachment; filename=PowerPointFile.pptx";
Aspose.Slides.Export.SaveFormat sfOutputFormat = Aspose.Slides.Export.SaveFormat.Pptx;
HttpContext.Current.Response.ContentType = strHttpResCT;
HttpContext.Current.Response.AddHeader("Content-Disposition", strHttpHdrCD);
pres.Save(HttpContext.Current.Response.OutputStream, sfOutputFormat);
HttpContext.Current.Response.Flush();
JS Code :
function blockUIForDownload() {
}
$(document).ready(function () {
AsyncPostBackEventHandler();
});
function AsyncPostBackEventHandler() {
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(showProgressBar_BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(hideProgressBar_EndRequestHandler);
}
function showProgressBar_BeginRequestHandler(sender, args) {
var show_progbar = false;
var postback_elems = new Array("Button1");
var postback_elem = args.get_postBackElement();
for (var i = 0; i < postback_elems.length; i++) {
if (postback_elem.id.search(postback_elems[i]) != -1) {
show_progbar = true;
break;
}
}
if (show_progbar) {
alert("loading");
}
}
function hideProgressBar_EndRequestHandler(sender, args) {
try
{
if (args.get_error() != undefined) {
}
alert('Finished');
finishDownload();
}
catch(e){}
finally{}
}
chetan.sarod...
All-Star
65759 Points
11153 Posts
Re: Microsoft JScript runtime error
Feb 16, 2012 02:31 AM|LINK
Hi
It is not a good practice to use Response.Write from within an ASP.NET page in general. As UpdatePanels work by intercepting the page rendering process you are recieving the errors.
You can put the code to generate the data in an HTTPHandler or you can make the button a PostBackTrigger.
There are many other possible causes besides Response.Write.
The general idea is that the response should conform to certain format, for instance: "111|updatePanel|UpdatePanel1| .... ", otherwise, the ajax library won't be able to parse it. And an exception is thrown.
You may use Fiddler to view the view the traffic, and you will see what response is returned from the server with the help of it. Then, it'll be easier to find out the real cause.
http://alpascual.com/blog/al/archive/2008/04/23/how-to-fix-sys-webforms-pagerequestmanagerparsererrorexception-in-ajax-1-0.aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
rakeshbpatel
Member
2 Points
2 Posts
Re: Microsoft JScript runtime error
Feb 16, 2012 01:58 PM|LINK
http://alpascual.com/blog/al/archive/2008/04/23/how-to-fix-sys-webforms-pagerequestmanagerparsererrorexception-in-ajax-1-0.aspx is not working
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: Microsoft JScript runtime error
Feb 20, 2012 01:30 AM|LINK
Hello
The error may come when client side script tries to parse the response from the server. The response may be in format, for example XML, JSON, or plain texts. For controls provided by Aspose, you may seek advices at http://www.aspose.com/community/forums/default.aspx
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
Amarnath6
Member
6 Points
3 Posts
Re: Microsoft JScript runtime error
May 02, 2012 09:31 AM|LINK
SharePoint registers a JavaScript "on submit" handler through INIT.js. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since "Download postback" does not refresh the page this variable remains true.
Hence subsequent button clicks stop working. There is an easy way to work around this issue. Register OnClientClick event for the button click and set _spFormOnSubmitCalled to false.
And put the script below in the page/js file,
<script type="text/javascript"> function setFormSubmitToFalse() { _spFormOnSubmitCalled = false; return true; } </script>Amarnath6
Member
6 Points
3 Posts
Re: Microsoft JScript runtime error
May 02, 2012 09:32 AM|LINK
SharePoint registers a JavaScript "on submit" handler through INIT.js. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since "Download postback" does not refresh the page this variable remains true.
Hence subsequent button clicks stop working. There is an easy way to work around this issue. Register OnClientClick event for the button click and set _spFormOnSubmitCalled to false.
And put the script below in the page/js file,
<script type="text/javascript"> function setFormSubmitToFalse() { _spFormOnSubmitCalled = false; return true; } </script>Amarnath6
Member
6 Points
3 Posts
Re: Microsoft JScript runtime error
May 02, 2012 09:32 AM|LINK
SharePoint registers a JavaScript "on submit" handler through INIT.js. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since "Download postback" does not refresh the page this variable remains true.
Hence subsequent button clicks stop working. There is an easy way to work around this issue. Register OnClientClick event for the button click and set _spFormOnSubmitCalled to false.
And put the script below in the page/js file,
<script type="text/javascript"> function setFormSubmitToFalse() { _spFormOnSubmitCalled = false; return true; } </script>