469,282 Members | 2,034 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

transfering variables with CONTEXT

I'm using context to transfer variables from 1 page to another.
But, with more than 2 pages it fails.

Ex:
page1.aspx:
Context.Items.Add("customername", customername.text)
Server.Transfer("page2.aspx")

page2.aspx:
response.write(Context.Items("customername")) => returns the customername
of page1
Context.Items.Add("test", Context.Items("customername"))
Server.Transfer("page3.aspx")

page3.aspx:
response.write(Context.Items("test")) => returns nothing, how comes??
THX for help.
Nov 19 '05 #1
4 1953
You have to again add to the Context.

Context is limited to one page.
--
Cheers,
Gaurav Vaish
http://mastergaurav.org
http://mastergaurav.blogspot.com
---------------------

Nov 19 '05 #2
that's what I did.
I just gave it another name.

on page1:
Context.Items.Add("customername", customername.text)

on page2:
Context.Items.Add("test", Context.Items("customername"))

on page3:
response.write(Context.Items("test"))

THX
"MasterGaurav" <ga**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
You have to again add to the Context.

Context is limited to one page.
--
Cheers,
Gaurav Vaish
http://mastergaurav.org
http://mastergaurav.blogspot.com
---------------------

Nov 19 '05 #3
here

page1.aspx:
Context.Items.Add("customername", customername.text)
Server.Transfer("page2.aspx")

page2.aspx:
response.write(Context.Items("customername")) => returns the customername
of page1

OK

but
---------- Context.Items.Add("test",
ontext.Items("customername")) ---------
Context.Items("customername") will not be there after page load. so keep
this value in a ViewState or a hidden val then pass that value.
"nicholas" <mu********@hotmail.com> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl...
I'm using context to transfer variables from 1 page to another.
But, with more than 2 pages it fails.

Ex:
page1.aspx:
Context.Items.Add("customername", customername.text)
Server.Transfer("page2.aspx")

page2.aspx:
response.write(Context.Items("customername")) => returns the customername of page1
Context.Items.Add("test", Context.Items("customername"))
Server.Transfer("page3.aspx")

page3.aspx:
response.write(Context.Items("test")) => returns nothing, how comes??
THX for help.

Nov 19 '05 #4
ok! I didn't know that it was only available in the page load.
thx a lot

"dinil" <di*****@eostek.com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
here

page1.aspx:
Context.Items.Add("customername", customername.text)
Server.Transfer("page2.aspx")

page2.aspx:
response.write(Context.Items("customername")) => returns the customername of page1

OK

but
---------- Context.Items.Add("test",
ontext.Items("customername")) ---------
Context.Items("customername") will not be there after page load. so keep
this value in a ViewState or a hidden val then pass that value.
"nicholas" <mu********@hotmail.com> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl...
I'm using context to transfer variables from 1 page to another.
But, with more than 2 pages it fails.

Ex:
page1.aspx:
Context.Items.Add("customername", customername.text)
Server.Transfer("page2.aspx")

page2.aspx:
response.write(Context.Items("customername")) => returns the

customername
of page1
Context.Items.Add("test", Context.Items("customername"))
Server.Transfer("page3.aspx")

page3.aspx:
response.write(Context.Items("test")) => returns nothing, how comes??
THX for help.


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by Mr. Ed | last post: by
2 posts views Thread by Piotr Karwatka | last post: by
2 posts views Thread by nicholas | last post: by
1 post views Thread by Shahid Juma | last post: by
26 posts views Thread by optimistx | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.