Persisting Information across forms

S

Shawn McNiven

Hi, I've got a problem I hope someone can help me with. First some long
winded explanations:

I have several forms: Countries.aspx, Country.aspx, Cities.aspx and
City.aspx. Countries displays a list of countries which can be filtered
with a search function. Country displays the selected record from
Countries. From Country, the user can select the "View Cities" button which
transfers them to the Cities page (in this case a listing of cities filtered
by the current Country record). The user can then select a city from the
list which brings them to the City record. City, Cities and Country all
have a "Return" button which brings them back to the page which called them.

If the user ends up in City.aspx, I want them to be able to select the
"Return" button which will bring them back to Cities.aspx (filtered by the
original country). If the user selects the "Return" button, they are
brought to the original country form. Selecting "Return" again brings them
to Countries.aspx (and if the page had previously been filtered, then
Countries.aspx with the filtered list).

Each of these pages can also be navigated to from a menu bar. If the user
is going to Cities or Countries using the menu bar, they are presented with
a complete list of records. If they are going to City or Country, they are
presented with a blank record form.

I'm using Server.Transfer for each of the navigation calls. Each form has a
public property of a class (Public Property TransferParameters() as
TransferParameters) which holds the parameters I want to pass along. On the
Page Load of the page being called, I use the Context.Handler to access the
TransferParameters and set properties on the new page (I also set some
hidden input fields, but would rather use the properties if I could).

Here are my questions:

1) After the page has been served, on the next action I can't access the
original public properties that were set on the page load. Is there a way
to persist that information after the page has been served (I can still get
the hidden input values).

2) The TransferParameter class that I'm using to pass parameters along has
the following properties: RecordID, AddNew, SearchOption and
ParentSearchOption. That works between Countries and Country, but when you
start going deeper (Cities and City) it starts to break down on the return
trip. How can City.aspx eventually let Countries.aspx know how to filter
the CountriesList (after going through Cities.aspx and Country.aspx)? Are
there some other parameters that should be included in TransferParameters?

3) Am I approaching this in the wrong manner? Should I just make use of the
querystring or session variables? Can anyone suggest any alternate
strategies?

Thanks everyone for slogging through this post. Hopefully someone will be
able to make sense of it!

Shawn McNiven
 
R

Richard Saunders

Shawn:

The problem is that a "page" only exists on the server while it's being
built. Once it's built, the page (and any properties set on the page)
are gone forever.

However, the Session lives for the entire session. I suspect that your
best bet is to create a class in the Session to hold the various info
that you want to persist.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top