Solved

Using PostbackURL and AJAX

Posted on 2011-02-17
3
633 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

707 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