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
RegardsTry 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" <John@.nospam.infovis.co.ukwrote in message
news:eqgC28EpGHA.504@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
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
>
>
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:
Quote:
Originally Posted by
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" <John@.nospam.infovis.co.ukwrote in message
news:eqgC28EpGHA.504@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
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
>
>
>
0 comments:
Post a Comment