views:

304

answers:

3

I'm am building my asp.net web application using MVC (Preview 5), and am also using the Master pages concept.

My PageA and PageB are both content pages. I'm doing a form submit in a method via JavaScript from PageA to PageB. PageB has its PreviousPageType attribute set to PageA, but when I access the PreviousPage property in PageB, it returns null.

Am I missing out on something here?

+1  A: 

I assume you want to access data of PageA in PageB. You can wrap the data in an object and use the Model Binders as described in Form Posting Scenarios by Scott Gu to pass it to the controller. You can then redirect to show PageB.

HTH,

Sunil Unnithan

Sunil
A: 
@Sunil
Using Model binders I can only access those variables that have been POSTed. 
The thing is, I have an object having MANY attributes (including other 
objects). I won't be able to access the entire object including all the 
properties, unless I post the values of all those attributes that I need 
on the other page. 
Implementing a custom model binder would just make it look visually clean. 
I would still have to post all the values I need.

Had I been able to use PreviousPage property, I could've just accessed 
the entire Portfolio object as is on the next page.

A different thing I could do is, I could serialize the entire object into 
a hidden variable and post it with the form. But that would be the last 
resort.

Any other ideas? Anybody?
Prakash
+1  A: 

You can use TempData to store an object that your next request will need access to, this is how I avoid passing big lumps of data between sequence pages.

Simon Steele