Free Support Forum -

Strange problem when opening window from Javascript

I have an ASPX form that I have been successfully calling the following control on my page:

A href="export.aspx?type=exportxls" target="_blank"

But I am currently creating a report options page that will have two datepickers, a dropdown that lists the report options, and a linkbutton to generate. When the user hits the linkbutton, the following event is fired:

Session("StartDate") = Me.wdcStart.Value
Session("EndDate") = Me.wdcEnd.Value
Select Case Me.ddlType.SelectedValue
Case 1
Case 2 : Response.Write("")
Case 3
Case 4
End Select

Problem is, when the second method is used and I get to the .Save part of the code, it seems to asking me save the page name, not the explicit filename I specified. It asks me if I want to Open/Save/Cancel the file "'export.aspx?type=exportxls". If I try to save or open, I get the following error:

Could not open 'http://localhost/pathtomyproject/export.aspx?type=exportxls'

Basically, it works perfectly with the hyperlink control, but not the inline javascript. Any ideas?



Hi Rob,

I don't find this problem in my machine. Maybe you have to update your windows and IE. And please check the security settings in your IE to see if it allows prompt window.

I create an aspx page and place a button in this page. In the button click event, I write the following code:


In the Page_Load event of webform2.aspx, I add the following code:

Excel excel = new Excel();
excel.Save("book1.xls", SaveType.OpenInExcel, FileFormatType.Default, this.Response);

It works fine.

You are absolutely right - I created test app and everything there worked perfectly. I will have to investigate my code to see what the problem is exactly.