473,395 Members | 1,530 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,395 software developers and data experts.

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 2114
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Andy Fish | last post by:
Hi, can anybody put forward a sensible argument javascript's behaviour of creating a new global variable whenever I assign to a previously undeclared variable. I can't beleive this is just for...
2
by: Niyazi | last post by:
Hi, I have BIG question and I gues it is the BEST question. I have a problem that I am guessing the best solution is to create some sort ..NET Services. This Service(s) must check every...
28
by: Mr. Ed | last post by:
This should be easy, but I can't immediately see what the answer is... I have some code which needs to be re-entrant. It also needs to create a unique identifier. The obvious way to create a...
1
by: Steve Remer | last post by:
My application (relevant code snippets below) originally used Session variables in order to maintain state from page to page. After being unable to solve the mystery of why those variables were...
2
by: Piotr Karwatka | last post by:
Hi! I have a little problem an qeustion. In .NET Windows Forms I can do something like that: - i have forms - Form1 Form2, on first form i have TextBox1 control on 2nd form I have Button1...
2
by: nicholas | last post by:
When I transfer variables from 1 page to another I add the variables in the querystring. So, in the script of my asp-button I put for ex.: response.redirect("thenewpage.aspx?myvar=<%=...
1
by: Shahid Juma | last post by:
Hi, This may be a very trivial answer but I was wondering if it possible to have a ASP.NET page and on a user click, it transfers to another page. Rather than redirecting to the new page, I want...
2
by: Rob Long | last post by:
Hi there Is there any way to access private variables directly from within a priviliged function? I have a situation where the priviliged function's execution context contains variables of the...
26
by: optimistx | last post by:
A variable in global scope var a1 = 'contents of global variable a1'; can be references (with some limitations) as window; // or window.a1; // or even window;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.