DayPilot Knowledge Base

AJAX Calendar/Scheduling Controls
DayPilot Pro (AJAX Calendar Control)
» DayPilot ASP.NET Calendar
DayPilot Pro (AJAX Monthly Calendar Control)
» DayPilot ASP.NET Monthly Calendar
DayPilot Pro (AJAX Scheduler Control)
» DayPilot ASP.NET Scheduler
DayPilot » Knowledge Base » How to force download of exported calendar/scheduler image (PNG)

How to force download of exported calendar/scheduler image (PNG)

Last revision: Feb 18, 2010

Add Content-Disposition header with "attachment" value. You can also specify the filename which will be suggested in the Save as dialog:

Response.AddHeader("content-disposition", "attachment;filename=print.png");

Example

    protected void ButtonExport_Click(object sender, EventArgs e)
    {
        setDataSourceAndBind();

        Response.Clear();
        Response.ContentType = "image/png";
        Response.AddHeader("content-disposition", "attachment;filename=print.png");
        MemoryStream img = DayPilotScheduler1.Export(ImageFormat.Png);
        img.WriteTo(Response.OutputStream);
        Response.End();

    }

Related

How to add a header to the exported calendar image (PNG)
Sys.WebForms.PageRequestManagerParserErrorException on PNG export button click
DayPilot and reset.css
How to make the modal dialog draggable