- Home
- Forum
- ASP.NET Web Forms (Classic)
- Diagram and Response.WriteFile
Diagram and Response.WriteFile
- Nov 4, 2009 01:16 PM UTC
- Nov 9, 2009 09:03 AM 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.
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:
...
...
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.
SIGN IN To post a reply.
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
Thanks for the update.
Regards,
Dinesh
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
MV Marco Vieira
- Nov 4, 2009 01:16 PM UTC
- Nov 9, 2009 09:03 AM UTC