Solved

Using PostbackURL and AJAX

Posted on 2011-02-17
3
601 Views
Last Modified: 2012-08-13
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
        With Response
            .ClearContent()
            Dim filename As String
            filename = PreviousPage.SharedExportName
            .AddHeader("content-disposition", "attachment; filename=" & filename & ".xls")
            .ContentType = "application/ms-excel"
            .Write(PreviousPage.SharedOutput())
            .End()
        End With
    End Sub

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.
0
Comment
Question by:donrueter
3 Comments
 
LVL 9

Accepted Solution

by:
rawinnlnx9 earned 250 total points
ID: 34921077
Enumerate each control and see if it has the PostbackURL property and if it does change that property.


I tried to do this from memory as I don't have VS where I am.
foreach (Control c in parent.Controls)
{
        PropertyInfo[] properties = c.GetType.GetProperties(); 

        foreach (PropertyInfo controlProperty in properties) 
        { 
            if (controlProperty.Name == "PostBackURL") 
            { 
            } 
        }
    
}

Open in new window

0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 35906850
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now