Thursday, March 29, 2012

Passing Values Between Web Forms Pages

I am porting an old client/server application to asp.net. I used to
retrieve data into local tables (Paradox table-files on the client's
disk) and work on them before saving them back to the server. What is
the approach for this in asp.net? The comments in MSDN on using the
session object are scary, imagining that several users at the same
time will use plenty of space on the server's memory! Or is it
realistic to memorize the data in a page and access them from the
following pages?
Thank for your help!You can add objects to the HttpContext of the current Page, and then use
Server.Transfer to transfer to the next page. The HttpContext is transferred
as well, and you can pull the data from the original page out of that.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.

"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307250620.7aed635b@.posting.google.c om...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutori...?tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net

"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307250620.7aed635b@.posting.google.c om...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
There are a lot of options to transferring values between pages: Session
like you've mentioned, The querystring (of course), But you may want to look
into Server.Transfer and the Context Object.

I hope this leads you in the right direction.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307250620.7aed635b@.posting.google.c om...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
Actually what I want to transfer between forms is huge tables... do
you think it is appropriate to use the server.transfer?

cgian31@.katamail.com (cgia) wrote in message news:<b35db8fd.0307250620.7aed635b@.posting.google.com>...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
Yes, that seems like one of the more efficient solutions for this particular
problem.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net

"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307251918.2ad13d06@.posting.google.c om...
> Actually what I want to transfer between forms is huge tables... do
> you think it is appropriate to use the server.transfer?
>
> cgian31@.katamail.com (cgia) wrote in message
news:<b35db8fd.0307250620.7aed635b@.posting.google.com>...
> > I am porting an old client/server application to asp.net. I used to
> > retrieve data into local tables (Paradox table-files on the client's
> > disk) and work on them before saving them back to the server. What is
> > the approach for this in asp.net? The comments in MSDN on using the
> > session object are scary, imagining that several users at the same
> > time will use plenty of space on the server's memory! Or is it
> > realistic to memorize the data in a page and access them from the
> > following pages?
> > Thank for your help!

0 comments:

Post a Comment