Cross page posting and viewstate question

  • Thread starter Thread starter J055
  • Start date Start date
J

J055

Hi

I'd like to post a page to another page using LinkButton.PostBackUrl. Then
using another LinkButton on the target page post back to the source page and
restore the controls to the state they were in before the first post to the
target.

Is there an easy way to do this? Perhaps I should consider another approach?

Many thanks
Andrew
 
Not an easy way, unless they are databound controls and you have state
somwhere in session and ready for redatabinding. Another trick is to save
viewstate to session and use a hack to make the page think it's a postback
and therefor load state from session as if it's loaded from viewstate on
postback, but it's not the easiest thing.

http://authors.aspalliance.com/PaulWilson/Articles/Default.aspx?id=10

Couldn't you just put them on the same page and switch the display with
Panels or MultiView?
 
Hi Teemu

Thanks for the tip. I hadn't really looked into cross page posting until now
so wasn't sure if it was useful for my requirements. I've used your approach
of using controls on the same page, hiding and unhiding them as necessary,
which is a lot neater and works fine now.

Many thanks
Andrew
 
Back
Top