We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Diagram and Response.WriteFile

Hello,

At the moment I'm trying out the diagram component.

I've come across an issue regarding having the diagram in an update panel and a link button which exports the diagram as an image.

I can interact with the diagram an intended, but, when I click the export button I retrieve the image, and write it to the http response to force the download box. However, after the file in downloaded/opened/cancelled I can no longer interact normally with the diagram. If I try to drag a symbol, the waiting popup shows up and just stays there.

I've noticed that after exporting the image once, and trying to drag a symbol, the method for the export button click is repeated before calling the node drop method.

Here is the markup for the button and diagram:

...

onclick="Export1_Click">Exportar

...



height="700px" width="498px" DisabledBackgroundColor="Gray"
EnableNodeResize="False"
oncanvaclick="diagramwebcontrol1_CanvaClick"
onnodeclick="diagramwebcontrol1_NodeClick"
onnodedoubleclick="diagramwebcontrol1_NodeDoubleClick"
onnodedrop="diagramwebcontrol1_NodeDrop"
onnodeupdate="diagramwebcontrol1_NodeUpdate" ShowWaitingPopupOnCallback="True"
WaitingPopupAutoFormat="BlackIndicator" WaitingPopupText=""
WaitingPopupTransparency="50" Font-Names="Arial" Font-Size="12pt"
onload="diagramwebcontrol1_Load" BoundaryConstraintsEnabled="True"
EnableXHTML="False"
oncallbackrefresh="diagramwebcontrol1_CallbackRefresh"
EnableNodeSelection="False">







...


And here is the code behind:

...

protected void Export1_Click(object sender, EventArgs e)
{
System.Drawing.Image vImgExport = diagramwebcontrol1.ExportDiagramAsImage(true);

Guid vId = Guid.NewGuid();

string vStrFileName = "Image_" + vId + ".jpeg";

string vStrMapa = Server.MapPath("~/Temp/" + vStrFileName);

vImgExport.Save(vStrMapa);

System.IO.MemoryStream vMemStrm = new System.IO.MemoryStream();
vImgExport.Save(vMemStrm, System.Drawing.Imaging.ImageFormat.Bmp);

vImgExport.Dispose();

Response.ContentType = "image/bmp";

Response.AddHeader("content-disposition", "attachment; filename=" + vStrFileName);

Response.WriteFile(vStrMapa);

Response.Flush();

Response.Close();
}

...

Any ideas? Why is the Export1_Click method called again before the NodeDrop method? Is it related to the problem?

Thanks in advance.

2 Replies

MV Marco Vieira November 4, 2009 04:39 PM UTC

I've got this. By setting EnableCallbacks to false I've over come this situation.


DM Dinesh M Syncfusion Team November 9, 2009 09:03 AM UTC

Hi Marco,

Thanks for the update.

Regards,
Dinesh

Loader.
Live Chat Icon For mobile
Up arrow icon