Home Unanswered Active Tags New Question

Exporting DayPilotMonth to image gives parsing error

Any advice or sample code on how to successfully use the new Export() method for DayPilotMonth? I am getting the error:

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

Here is my code:

protected void ButtonExport_Click(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "image/png";
Response.AddHeader("content-disposition", "attachment;filename=EventCalendar.png");
MemoryStream img = dpmCalendar.Export(ImageFormat.Png);
img.WriteTo(Response.OutputStream);
Response.End();
}

I have tried a number of different image formats, and also played with different charsets and encodings on the Response, but the error persists. I have been unable to find any examples for the DayPilotMonth.Export method.

Asked by Josh Fuller 1 year ago.
Replies

Forgot to mention I am using DayPilot Pro 6.0 SP1 and Internet Explorer 7

Comment posted by Josh Fuller 1 year ago.

I would have thought this would be an easy question for somebody...nothing? Does the error mean that the Export method doesn't return a proper image, or am I doing something wrong?

Comment posted by Josh Fuller 1 year ago.

My export button was in an UpdatePanel and thus not doing a full postback. This line in the PageLoad fixes the issue:

ScriptManager.GetCurrent(this).RegisterPostBackControl(btnExport);

Comment posted by Josh Fuller 1 year ago.
Comment posted by Dan Letecky 1 year ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java