-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: PSingh
Message 1 in Discussion

Hi All,   I had a requirement for exporting data to excel format. when i searched the 
net, i got the following code.   DataGrid1.DataSource = yourdataset or yourdatareader
 DataGrid1.DataBind()

'**Set the MIME type to Excel.
Response.ContentType = "application/vnd.ms-excel"

'**Remove the charset from the Content-Type header.
    Response.Charset = ""
    Dim strw As New System.IO.StringWriter()
    Dim htmlw As New System.Web.UI.HtmlTextWriter(tw)

'**HTML for the literal control.
'**Read limitations
   DataGrid1.RenderControl(htmlw)

'**Write the HTML back to the browser.
    Response.Write(strw.ToString())
'**End the response.
    Response.End()
 I have put this piece of code on a different window and in Page_Load event. When i 
execute this piece of code, the page load even is called twice. The funny part is both 
the times, the sessionId is different. This is causing me problems. When i 
investigated the code, the line Response.ContentType = "application/vnd.ms-excel" is 
causing the page to reload with a different sessionId. Am losing all my session values 
becaue of this. Can anyone help me.    Regards, Pradeep.

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to