Tech Off Thread

5 posts

Content Header??

Back to Forum: Tech Off
  • venkatzeus

    Hi ,

    I do have a page in which I want to open an xml file in a button click. In the button click am opening an aspx page through JavaScript location.href(). In the aspx page am simply adding a file using an addheader method and using response.write am writing an XML string to that file. Like ...

    Response.AddHeader("Content-disposition", "attachment; filename=" + FileName + ".xml");
    Response.ContentType = "application/xml";
    Response.Write(FileContent);

    The problem is something like when am clicking the button in the main page the dialog window asking whether to Open, Save or Cancel is popping out, if am giving Open then the particular Xml file is been opened in the same page. I do want to open this particular Xml file in another blank window. Is this possible? If possible how can I do that?

    Thanks in Advance.

  • LostIn​Tangent

    As far as I know it's not really possible. You could use window.open instead of just setting the location.href property of the current window, which would give you the new window if the user choose Open instead of Save. But if they chose Save, the new window would still be left open, which isn't ideal.

    It's pretty standard behavior to have the downloaded content replace the current window if the user chooses Open anyways.

  • venkatzeus

    Thanks for the reply. Is there any work-around for this?

    Please Help

  • venkatzeus

    Hi..

    The problem here is that i am not able to open XML files in a new page.. They are getting opened in the same page. Imagine this scenario, i have uploaded a xml file. Now i want to download that xml file. when the pop up window opens, i have the open,save and cancel buttons. If i click on the open button, the xml page is getting opened in the same page of the parent page. How to make the xml files to be opened in a new window?

    Please help 

  • venkatzeus

    I am able to get the xml page in a new window. Now the problem is this: The new page will be displayed before the pop window(ie, the open , save,cancel window) actually comes. so if the user clicks on the save or cancel button, the new page is still present.  How to dispose the opened page if the user clicks on save or cancel button?

    Actually when you click the master page's button that time itself the pop window is popping up.. When that page is been loaded since in that page header we are appending the content the download window is popping out. At that time if am canceling or even if am saving the content the opener pop window is still there. I want to kill that window in case of cancel or save.
     
    Is there any work-arounds to achieve it by code?
     
    Please help

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.