Re: Persisting Information across forms

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Richard Saunders (rsaund_at_hotpopdotcom)
Date: 04/07/04


Date: Wed, 07 Apr 2004 08:26:12 -0400

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



Relevant Pages

  • Re: Time to talk about Global Warming [was Re: Maccies arent fanatical? (by the way, what is a "Macc
    ... Yes it does depend on how one defines freedom. ... Discharge a firearm in the city and you'll get ... In the country, just put one up. ... cities can do that people living in rural areas can't. ...
    (comp.sys.mac.advocacy)
  • Re: Something to think about
    ... not cities and you'll see the light. ... Do you think they would live in the country with no services available? ... I really think that is the biggest flaw in the "Great Society" ... They piled all the welfare money up in the city where the ...
    (rec.boats)
  • Re: San Francisco So Far
    ... city and country. ... talking real country, as in I can see horses across the street out my ... Many of who live in Cities can't understand how country hicks do it ... parks of all types and historic attractions. ...
    (rec.food.cooking)
  • Re: San Francisco So Far
    ... city and country. ... Many of who live in Cities can't understand how country hicks do it ... I'm a reformed country bumpkin... ...
    (rec.food.cooking)
  • Persisting Information across forms
    ... Country displays the selected record from ... transfers them to the Cities page (in this case a listing of cities filtered ... public property of a class as ... TransferParameters) which holds the parameters I want to pass along. ...
    (microsoft.public.dotnet.framework.aspnet)