C
claudia villatoro via .NET 247
Hi
I have a page with an option for opening the result( dataset) inexcel and it works, but the excel's file opens in the currentpage, I'd like to open it in a new page, How could I do ? ( Ithink I have to change the Reponse.write, but I don't know thecorrect parameters ...)
I put my code :
....
'first let's clean up the response.object
response.Clear()
response.Charset = ""
'set the response mime type for excel
response.ContentType = "application/vnd.ms-excel"
'create a string writer
Dim stringWrite As New System.IO.StringWriter()
'create an htmltextwriter which uses thestringwriter
Dim htmlWrite As NewSystem.Web.UI.HtmlTextWriter(stringWrite)
'instantiate a datagrid
Dim dg As New DataGrid()
'set the datagrid datasource to the dataset passedin
dg.DataSource = dv
'bind the datagrid
dg.DataBind()
'tell the datagrid to render itself to ourhtmltextwriter
dg.RenderControl(htmlWrite)
'all that's left is to output the html
response.Write(stringWrite.ToString) <-- Do I changeit ? how ?
response.End()
I have a page with an option for opening the result( dataset) inexcel and it works, but the excel's file opens in the currentpage, I'd like to open it in a new page, How could I do ? ( Ithink I have to change the Reponse.write, but I don't know thecorrect parameters ...)
I put my code :
....
'first let's clean up the response.object
response.Clear()
response.Charset = ""
'set the response mime type for excel
response.ContentType = "application/vnd.ms-excel"
'create a string writer
Dim stringWrite As New System.IO.StringWriter()
'create an htmltextwriter which uses thestringwriter
Dim htmlWrite As NewSystem.Web.UI.HtmlTextWriter(stringWrite)
'instantiate a datagrid
Dim dg As New DataGrid()
'set the datagrid datasource to the dataset passedin
dg.DataSource = dv
'bind the datagrid
dg.DataBind()
'tell the datagrid to render itself to ourhtmltextwriter
dg.RenderControl(htmlWrite)
'all that's left is to output the html
response.Write(stringWrite.ToString) <-- Do I changeit ? how ?
response.End()