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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Diagram and Response.WriteFile

Thread ID:

Created:

Updated:

Platform:

Replies:

91117 Nov 4,2009 01:16 PM UTC Nov 9,2009 09:03 AM UTC ASP.NET Web Forms (Classic) 2
loading
Tags: DiagramWebControl
Marco Vieira
Asked On November 4, 2009 01:16 PM UTC

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.

Marco Vieira
Replied On November 4, 2009 04:39 PM UTC

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

Dinesh M [Syncfusion]
Replied On November 9, 2009 09:03 AM UTC

Hi Marco,

Thanks for the update.

Regards,
Dinesh

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;