[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using PostbackURL and AJAX

Posted on 2011-02-17
3
Medium Priority
?
659 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
2 Comments
 
LVL 9

Accepted Solution

by:
rawinnlnx9 earned 1000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 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