473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Passing values between two pages

Hi

In my source page I am using;

Context.Items("Msg") = Msg
Response.Redirect("Destination_Page.aspx")

In my destination page in Page_Load event I am using;

lblMsg.Text = CType(Context.Items("Msg"), String)

But the value does not get to the destination page. Is there a more
reliable way to pass a string between pages?

Thanks

Regards
Jul 10 '06 #1
2 1477
Try a Server.Transfer("WebForm2.aspx");
instead of Redirect.
Note this technique does not work if you use Response.Redirect. A Redirect
results in another round trip to the client and a new HTTP request - thus a
new Context object without our ArrayList. To span requests, you'll need to
use the Session object or another state container. Also, there are other
techniques you can use to pass state between two forms when using
Server.Transfer, these other techniques can be found in the resources
section of the article.
http://www.odetocode.com/Articles/111.aspx

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:eq*************@TK2MSFTNGP05.phx.gbl...
Hi

In my source page I am using;

Context.Items("Msg") = Msg
Response.Redirect("Destination_Page.aspx")

In my destination page in Page_Load event I am using;

lblMsg.Text = CType(Context.Items("Msg"), String)

But the value does not get to the destination page. Is there a more
reliable way to pass a string between pages?

Thanks

Regards


Jul 10 '06 #2
If you use Server.Transfer then on the next page you can reference the
PreviousPage object and use the FindControl method to gain reference to
whatever control you want on the previous page (the one that did the
transfer).

--
-Demetri
"sloan" wrote:
Try a Server.Transfer("WebForm2.aspx");
instead of Redirect.
Note this technique does not work if you use Response.Redirect. A Redirect
results in another round trip to the client and a new HTTP request - thus a
new Context object without our ArrayList. To span requests, you'll need to
use the Session object or another state container. Also, there are other
techniques you can use to pass state between two forms when using
Server.Transfer, these other techniques can be found in the resources
section of the article.
http://www.odetocode.com/Articles/111.aspx

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:eq*************@TK2MSFTNGP05.phx.gbl...
Hi

In my source page I am using;

Context.Items("Msg") = Msg
Response.Redirect("Destination_Page.aspx")

In my destination page in Page_Load event I am using;

lblMsg.Text = CType(Context.Items("Msg"), String)

But the value does not get to the destination page. Is there a more
reliable way to pass a string between pages?

Thanks

Regards


Jul 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
5
by: Raju V.K | last post by:
I am developing a web site which requires a set og unique values be transferred between pages and server many times. There fore i decided to put the values in an array so that only one reference to...
1
by: Matt M | last post by:
Ok. So I'm passing values between web pages, as per microsoft's framework development guide (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/ht...
4
by: rick | last post by:
Does anyone having a working example of passing values between web forms pages? I tried the example in the ms- help but I can't get by the following: To read property values from the source...
4
by: Gibs | last post by:
Hi I have two aspx pages in a frame and in the top page i am creating the controls dynamically and putting in a place holder. I have a hyperlink in this page to populate the data in the bottom...
2
by: VS_NET_DEV | last post by:
Hi All, There two ways of passing values between pages - 1) Context.Items.Add 2) Context.Handler (cast the page1 class etc) I know for sure #2 does not store the values between requests. How...
1
by: olduncleamos | last post by:
Hello all. With a background in ASP, I am finding the work required for passing values between pages mystifying. For various obvious reasons, I have eliminated using cookies and session to store...
1
by: Steve | last post by:
After a few hours of trial and error I have reached the following conclusions, can you please tell me if I am right: I have 2 aspx pages both with the same master page and I wish to pass values...
3
by: dbuchanan | last post by:
newbie question What are the various ways that data can be passed between pages. For example; How is data about the logged in user passed to subsequent pages Thank you, Doug
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.