transfering variables with CONTEXT

N

nicholas

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

nicholas

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
 
D

dinil

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top