DayPilot Knowledge Base

AJAX Calendar/Scheduling Controls
DayPilot Pro (AJAX Calendar Control)
» DayPilot AJAX Calendar
DayPilot Pro (AJAX Monthly Calendar Control)
» DayPilot AJAX Monthly Calendar
DayPilot Pro (AJAX Scheduler Control)
» DayPilot AJAX Scheduler
DayPilot » Knowledge Base » Sys.WebForms.PageRequestManagerParserErrorException on PNG export button click

Sys.WebForms.PageRequestManagerParserErrorException on PNG export button click

Last revision: Aug 31, 2010


You may get the following JavaScript error when clicking the Export button:

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 'PNG

The sample Export button fires the following code.

    protected void ButtonExport_Click(object sender, EventArgs e)
        DayPilotMonth1.DataSource = getData(DayPilotMonth1.VisibleStart, DayPilotMonth1.VisibleEnd, (string)DayPilotMonth1.ClientState["filter"]);

        Response.ContentType = "image/png";
        Response.AddHeader("Content-Disposition", "attachment;filename=print.png");

It modifies the Response to return the PNG image instead of the page. That will not work if the button click is handled using partial PostBack.

In order to make the button work you need to handle the button click using a full page PostBack:


How to add a header to the exported calendar image (PNG)
How to open a new event dialog using TimeRangeSelected event (modal.js)
Writing PNG to Response.OutputStream - System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
How to show event details in a modal dialog (modal.js)