Using PostbackURL and AJAX
Posted on 2011-02-17
I have an ASP.Net/AJAX page named ViewLoads that is a fairly complex collection of updatepanels, multiviews, and controls of all kinds. It's working great.
Now I have added a control (cmdExportCampusTotals) which really has no code but has PostBackURL set to ~/GenerateFile.aspx. This activates that page in a hidden iFrame on the original page and downloads an Excel spreadsheet using this VB code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim filename As String
filename = PreviousPage.SharedExportName
.AddHeader("content-disposition", "attachment; filename=" & filename & ".xls")
.ContentType = "application/ms-excel"
Everything is working fine, and the original user interface still displays unscathed. But now, clicking any control in the page causes a postback to GenerateFile.aspx. How can I reset the page so that it posts back to ViewLoads.aspx instead?
Some of my searching has suggested using the RegisterStartupScript of the ScriptManager control, but I have not been successful in making that happen.