There is a good Microsoft example (not the one you're quoting) showing this,
but the typical approach is:
<input type="button"
onclick='Window.Open("http://example.com/MyAspPage.aspx?bExcel=true")'>Click
here for Excel</input>
Then you use the QueryString server side to determine if it is a request for
Excel. There are numerous variations on this. What you don't want to do is
use the MIME type in the URL, because then someone can specify any random
MIME type and could use it as an attack mechanism (if unvalidated).
"Steve Schroeder" wrote:
Using this code, how might I render the results to a new browser window and
leave the original as it? Thanks...
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
dgInvoice.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
FYI...not my code, source is:
http://support.microsoft.com/default...b;en-us;317719
Thanks