By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,225 Members | 2,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,225 IT Pros & Developers. It's quick & easy.

Persisting Information across forms

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Shawn McNiven wrote:
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

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.