Groups | Blog | Home
all groups > vb.net controls > august 2006 >

vb.net controls : Response object



krallabandi NO[at]SPAM gmail.com
8/1/2006 10:19:34 AM
Hi,

I am using Response object in vb.net to download an excel sheet with
data.
It worked well and I could download excel file with data. But suddenly
It started downloading only blank excel sheet. even though the data
exists. Do I need to do any refreshing? or do I need to re-start IIS?


Dim dt As DataTable = DSCAG.Tables(0)

Dim strFileName As String = "Downloadfile.xls"
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;
filename=""" & strFileName & """")
Response.ContentEncoding = System.Text.Encoding.UTF7
Response.Charset = ""
EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHTMLTextWriter As New
System.Web.UI.HtmlTextWriter(oStringWriter)

DGCAGReference.DataSource = dt
DGCAGReference.DataBind()

DGCAGReference.RenderControl(oHTMLTextWriter)

Dim strResponse As String = oStringWriter.ToString
strResponse = strResponse.Replace("</td>", "&nbsp;</td>")
Response.Write(strResponse)

Thanks.
krallabandi NO[at]SPAM gmail.com
8/2/2006 5:32:12 AM
any ideas on this problem pls?

Thanks

[quoted text, click to view]
krallabandi NO[at]SPAM gmail.com
8/2/2006 7:21:52 AM
I have noticed that in the blank excel sheet the excel sheet name is
".xls]Downloadfile[1]". I don't understand why the excel sheet name is
like that.

any ideas?

Thanks



[quoted text, click to view]
AddThis Social Bookmark Button