Solved

Postback Not Working Correctly

Posted on 2009-05-14
6
527 Views
Last Modified: 2012-05-07
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
Comment
Question by:ITHelper80
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Muhammad Ousama Ghazali
ID: 24390930
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
 
LVL 7

Expert Comment

by:ajolly
ID: 24391729
can you test if it is a browser/firewall dependant issue?
0
 
LVL 6

Author Comment

by:ITHelper80
ID: 24394851
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 11

Expert Comment

by:Muhammad Ousama Ghazali
ID: 24395449
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
 
LVL 6

Author Comment

by:ITHelper80
ID: 24395490
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
 
LVL 11

Accepted Solution

by:
Muhammad Ousama Ghazali earned 500 total points
ID: 24395767
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now