views:

20

answers:

2

Here is the brief detail of issue.

  1. I have Page1 where I have put LinkButton. The LinkButton Has property PostBackUrl pointing to Page2.

  2. When user is redirected to page2, I am using Page Load method to access controls from previous page & get the needed value. To make clear, I am using this approach becuase I cant use querystring.

  3. Page 2 has 2 web parts on it. The web parts use data received in Page Load event from page1 and renders data.

  4. This works perfect on first page load. When user clicks on a URL in page which posts back, the web parts gets lost.

  5. Note that if I come directly to page2 without going at page1, then web parts are retained in the page and they are not lost.

Can anyone give me the clue of issue cause?

Thanks in advance.

A: 

Do you have any debugging enabled? you are most likely looking for values on page load that don't exist and might be getting exceptions that aren't handled properly.

brian brinley
I have added a check in Page Load to get values pages posted from previous page only when Page IsCrossPostBack. When second page is posted back, then Page Load event does not get a hit.
Manoj
A: 

I am not sure why but somehow code was throwing an exception when I tried to access the property Page.PreviousPage. Though I had made sure to check null on each step. Even code was never get hit when web part was lost. So it is still a mystery for me.

Just in case someone comes across this issue my workaround may help. I used Post back to page2 using post method. I accessed the variables using Page.Form[] variables. This way my issue of getting web parts lost got resolved.

Manoj

related questions