Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 581
  • Last Modified:

Postback Not Working Correctly

Ive two pages and on the second page I have a button with a postback URL, and the following code on the target page.

The crazy thing is this did work earlier today but now the target page isnt seeing the PreviousPage IsNot Nothing) AndAlso (PreviousPage.IsCrossPagePostBack)  it skips over it and goes to the

        If Not Page.IsPostBack Then
            PageSubLoad()
        End If

Thanks!
On .Net page
<%@ PreviousPageType VirtualPath="~/Submitted Page.aspx"  %>
 
In code behind of target
  If (PreviousPage IsNot Nothing) AndAlso (PreviousPage.IsCrossPagePostBack) Then
 
            txtEmpName.Text = PreviousPage.Empnum
            txtWork.Text = PreviousPage.Workcenter
            txtDept.Text = PreviousPage.Dept
            txtIncident.Text = PreviousPage.Details
            txtWitness.Text = PreviousPage.Witness
            txtCause.Text = PreviousPage.Cause
            txtInjury.Text = PreviousPage.Description
            txtDoing.Text = PreviousPage.Duty
            txtPPE.Text = PreviousPage.PPE
            txtTools.Text = PreviousPage.Tools
            txtEffort.Text = PreviousPage.Hours
            tblReturn.Visible = True
        End If

Open in new window

0
ITHelper80
Asked:
ITHelper80
  • 3
  • 2
1 Solution
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
The only thing that comes to mind after reading your code and official documenation (http://msdn.microsoft.com/en-us/library/ms178139.aspx) is that the page is being accessed directly. If it is not the case, try clearing the cache of the browser and try again, although it may seem far fetched.
0
 
ajollyCommented:
can you test if it is a browser/firewall dependant issue?
0
 
ITHelper80Author Commented:
Ive done some more debugging and it appears the PreviousPage IsNot Nothing statement is the problem....anyone know why the page is coming back as null?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
Try the following:
  1. Create a new ASPX page in your project.
  2. Place a button on this page, set its PostBackUrl property to Target Page.
  3. Debug the Target Page and check if the PreviousPage IsNot Nothing AndAlso PreviousPage.IsCrossPagePostBack becomes true or not.
I hope it is not the case, but just to make sure: Is the PostBackUrl of button points to a page within the same Web Application?
0
 
ITHelper80Author Commented:
Here is another strange thing. If I postback from the default page to my submitted page it works, but if I do a postback from the subbmitted page to the default it is returned as null....
0
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
It is due to the reason that Circular file references are not allowed. This is the message that you would receive at the start of the project if you also declare a PreviouPageType within Default.aspx file for SubmittedPage.aspx. However, when I did not have any declration for PreviousPageType on the Default page, and tested the cross-postback from submitted page, it still is working fine with the code snippet:

If PreviousPage IsNot Nothing AndAlso Me.IsCrossPagePostBack Then
End If
I'll suggest you to have a new sample web application project, create two page and test them. I just tested on my machine it is working fine as per above description.
 
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now