Hi every body,
I have a <asp:ImageButton> that is supposed to force the browser to open "Save As" dialog box in attempt to download an image into the client machine.
The image was previously produced successfully in a previous process:
Using bitmap As New Bitmap(188, 306)
browser.DrawToBitmap(bitmap, New Rectangle(0, 0, 188, 306))
Using stream As New MemoryStream()
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
Dim bytes As Byte() = stream.ToArray()
myImage.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(bytes)
End Using
End Using
and is shown successfully within the <asp:Image> tag.
My Download ImageButton has the following code behind:
Private Sub imgbtn_Download_Click(sender As Object, e As ImageClickEventArgs) Handles imgbtn_Download.Click
Dim bytes As Byte() = Convert.FromBase64String(myImage.ImageUrl.Split(",")(1))
Response.Clear()
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "image/png"
Response.AppendHeader("Content-Disposition", "attachment; filename=" + "abc.png")
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()
End Sub
I noticed that if the <asp:ImageButton> was placed inside <Telerik:RadAjaxPanel> the "Save As" dialog box doesn't pop up and the consequently download process doesn't start. However, if I shift the ImageButton control out of the <Telerik:RadAjaxPanel> it works successfuly.
So is there any explanation from Telerik Team why such behavior is taking place. And is there any recommendation to make the "Save As" downlaod process succeeds while the <asp:ImageButton> is inside the <Telerik:RadAjaxPanel>?
Regards;
I have a <asp:ImageButton> that is supposed to force the browser to open "Save As" dialog box in attempt to download an image into the client machine.
The image was previously produced successfully in a previous process:
Using bitmap As New Bitmap(188, 306)
browser.DrawToBitmap(bitmap, New Rectangle(0, 0, 188, 306))
Using stream As New MemoryStream()
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
Dim bytes As Byte() = stream.ToArray()
myImage.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(bytes)
End Using
End Using
and is shown successfully within the <asp:Image> tag.
My Download ImageButton has the following code behind:
Private Sub imgbtn_Download_Click(sender As Object, e As ImageClickEventArgs) Handles imgbtn_Download.Click
Dim bytes As Byte() = Convert.FromBase64String(myImage.ImageUrl.Split(",")(1))
Response.Clear()
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "image/png"
Response.AppendHeader("Content-Disposition", "attachment; filename=" + "abc.png")
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()
End Sub
I noticed that if the <asp:ImageButton> was placed inside <Telerik:RadAjaxPanel> the "Save As" dialog box doesn't pop up and the consequently download process doesn't start. However, if I shift the ImageButton control out of the <Telerik:RadAjaxPanel> it works successfuly.
So is there any explanation from Telerik Team why such behavior is taking place. And is there any recommendation to make the "Save As" downlaod process succeeds while the <asp:ImageButton> is inside the <Telerik:RadAjaxPanel>?
Regards;