search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Exporting DayPilotMonth to image gives parsing error

Asked by Josh Fuller
13 years ago.

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.

Comment posted by Josh Fuller
13 years ago.

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

Comment posted by Josh Fuller
13 years 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
13 years 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 Dan Letecky
13 years ago.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.