Welcome Guest Search | Active Topics | Sign In | Register

Response.BinaryWrite & CallbackPanel Options
Ellery Gomez
Posted: Sunday, November 16, 2014 11:24:19 PM
Rank: Member
Groups: Member

Joined: 8/4/2009
Posts: 16
Hello,

I have a page with 2 callback panels and a toolbar, I use the following code to download a file stored in a SQL Server database:

Code: Visual Basic.NET
Response.Clear()
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = lcDocType
Response.AppendHeader("Content-Disposition", "attachment; filename=" + lcDocName)
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()


The problem is when I execute it from a toolbar button, when I call it from a normal button I'm able to download the file.

Is there something in the code that I will could change to make it works from the toolbar button?

Thanks in advance. Kind Regards
eo_support
Posted: Monday, November 17, 2014 10:08:59 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Is the ToolBar button triggering a CallbackPanel callback? Or it's just a regular server post back?

Thanks!
Ellery Gomez
Posted: Monday, November 17, 2014 3:07:00 PM
Rank: Member
Groups: Member

Joined: 8/4/2009
Posts: 16
Hello,

I forgot to say the Toolbar button is triggering a CallbackPanel callback.

Regards
eo_support
Posted: Monday, November 17, 2014 3:09:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You can't download a file through Callback. Callback works by responding XML text data (so that the client code parse it and acts accordingly). This mutually exclusive with responding with binary file data. So a file download will not work through Callback.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.