Save Dialogue

J

jimmyfo

Hi, I've got some questions concerning getting the save dialogue to
popup when a link is clicked on. The particular issue I'm having is
that the file is returned dynamically (via a search) and I need to get
the file name for the save dialogue. I've heard that using ADO streams
keeps it from opening in the browser, and forces the popup for
"Save/Open" - does this work?

The ADO stream that I would like to use in the codebehind is SIMILAR to
this:


Dim FileName
Dim FullFileName
FileName = 'assigned elsewhere from SQL Query datatable
FullFileName = " 'assigned elsewhere from SQL Query datatable
Response.ContentType = "application/x-unknown"
Response.Addheader "Content-Disposition", "attachment;
filename=" &
chr(34) & FileName & chr(34)
Response.Binarywrite GetBinaryFile(FullFileName)


Function GetBinaryFile(ByVal FileSpec)
Const adTypeBinary = 1
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open()
objStream.Type = adTypeBinary
objStream.LoadFromFile (FileSpec)
GetBinaryFile = objStream.Read()
Set objStream = Nothing
End Function


Now how do I make the TemplateColumn in the ASP.Net portion linked, or
run this particular code? or is there a better way?


My column:
<asp:TemplateColumn
ItemStyle-HorizontalAlign="Center"><ItemTemplate><asp:Image ID="thumb"
runat="server" /></ItemTemplate></asp:TemplateColumn>


Do I use an anchor element? Some DataItem element? I need to get the
filename via the codebehind, so it needs to happen there. The filename,

thumbnails, etc are all grabbed in the DataGrids ItemDataBound
function.


Thanks!
James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top