Force save to file

J

Jon

I have the following functionality in my program when someone clicks on a
link, it brings up a page with an excel doc in it. I would however, like it
to force the save file dialog all the time, not open in the browser if excel
is there. How would I force that option?

Thanks

Private Sub lnkPrintFriendly_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lnkPrintFriendly.Click

Response.Clear()

Response.Buffer = True

Response.ContentType = "application/vnd.ms-excel"

Response.Charset = ""

EnableViewState = False

Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter

Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

ClearControls(Me.dgrHistory)

Me.dgrHistory.RenderControl(oHtmlTextWriter)

Response.Write(oStringWriter.ToString)

Response.End()

End Sub
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top