Pop up window to be displayed when using export to XML

Posted by Olwayz Nancy under ASP.NET on 9/20/2011 | Points: 10 | Views : 1157 | Status : [Member] | Replies : 2
I need a pop up window to be displayed(which shows open,save,cancel options) when clicked on "Export to XML" button. The file is being saved in the drive. But I want the user to save the XML file manually in the desired location.

DataSet ods_settle = new DataSet();
DateTime sdate = Convert.ToDateTime(txtFromDate.Text);
DateTime Enddate = Convert.ToDateTime(txtEndDate.Text);
oSAPPGCCSet.StartDate = Convert.ToDateTime(sdate);
oSAPPGCCSet.EndDate = Convert.ToDateTime(Enddate.Year + "-" + Enddate.Month + "-" + Enddate.Day);
string str_Proc = StoredProcNames.Settlement_usp_fd_GetBillingSettlement;
oSAPPGCCSet.ViewSettlement(out ods_settle, str_Proc);
grdSettlement.AllowPaging = false;
grdSettlement.DataSource = ods_settle;
ods_settle.WriteXml("c:\\BillingDate.xml");





Responses

Posted by: Ndebata on: 9/21/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
Try to write that xml to outputstream of response object and call the response end method.

Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=MYFILE.xml");
Response.ContentType = "application/text";
ods_settle.WriteXml(Response.OutputStream);
if (Response.IsClientConnected)
{
Response.Flush();
Response.End();
}


Olwayz Nancy, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Olwayz Nancy on: 9/21/2011 [Member] Starter | Points: 25

Up
0
Down
Thank you for the reponse.
I worked with this code.But when I click on Open button of the popup window, the XML document opens and later when I close the document the entire website is being closed which is not desired. If that is the case,the user has to again login.

Olwayz Nancy, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response