locked
Web part lost when page post back RRS feed

  • Question

  • 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.

    Monday, October 11, 2010 2:19 PM

Answers

  • Hi,

     

    I remembered this Property PostBackUrl didn’t work well for the  Content Page in SharePoint 2007.

    For more information, please refer to

    http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/4f8c5e8e-0a97-47a9-843b-6346aa6f5241

     

    For SharePoint 2010, I am not sure. But at least you can debug the webpart in page2(I saw you didn’t get any error)

    It’s possible reason you can’t get the value from previous page by using “PostBackUrl”.

     

    Hope this helps

     

    Thanks!

    Stanfford


    Everything will be fine.
    • Proposed as answer by Uday G Thursday, October 14, 2010 6:53 AM
    • Marked as answer by Stanfford Liu Wednesday, October 20, 2010 3:23 AM
    Thursday, October 14, 2010 5:15 AM
  • 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.

    • Marked as answer by Stanfford Liu Wednesday, October 20, 2010 3:23 AM
    Tuesday, October 19, 2010 10:59 AM

All replies

  • Hi,

     

    I remembered this Property PostBackUrl didn’t work well for the  Content Page in SharePoint 2007.

    For more information, please refer to

    http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/4f8c5e8e-0a97-47a9-843b-6346aa6f5241

     

    For SharePoint 2010, I am not sure. But at least you can debug the webpart in page2(I saw you didn’t get any error)

    It’s possible reason you can’t get the value from previous page by using “PostBackUrl”.

     

    Hope this helps

     

    Thanks!

    Stanfford


    Everything will be fine.
    • Proposed as answer by Uday G Thursday, October 14, 2010 6:53 AM
    • Marked as answer by Stanfford Liu Wednesday, October 20, 2010 3:23 AM
    Thursday, October 14, 2010 5:15 AM
  • 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.

    • Marked as answer by Stanfford Liu Wednesday, October 20, 2010 3:23 AM
    Tuesday, October 19, 2010 10:59 AM