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

New Message on BDOTNET

-----------------------------------------------------------
From: Thepelicanbrief2
Message 1 in Discussion

Hi Group,   Something silly is happening.   I have this code in a button click   
Response.ClearContent();  
Response.ClearHeaders(); 
Response.Clear(); 
Response.Charset = ""; 
Response.ContentType = "vnd.ms-excel"; 
string headerText; 
headerText = "<b>MRL Data (Maximum Residue Limit)</b>"; 
headerText = headerText + "<p><p>"; 
headerText = headerText + "Data Generated on " + DateTime.Now.ToString(); 
headerText = headerText + "<p><p>"; 
 
StringWriter stringWrite = new StringWriter(); 
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); 
DataGrid dg = new DataGrid(); 
 
dg.DataSource = (DataSet)Session["ds"]; 
dg.DataBind();  
dg.HeaderStyle.Font.Bold = true; 
dg.HeaderStyle.BackColor = Color.Wheat; 
dg.HeaderStyle.BorderStyle = BorderStyle.Solid; 
dg.RenderControl(htmlWrite); 
 
Response.AppendHeader("Content-Disposition", "attachment; filename=123.xls"); 
Response.Write(stringWrite.ToString()); 
Response.Flush();  
Response.End(); 
Response.Close(); 
I am sending the data from the server to the client changing the content type. Things 
are working fine but for one thing. 
User is getting a pop up open, save, cancel ... when he says open, he again gets a 
popup with the same message. But for the first time the name of the file is 
webpagename.aspx and second time the name of the file is 123.xls (which i am 
mentioning). Why is this happening?  
I am having a tough time with response object. 
Please help. 
cheers, 
sujay

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

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