473,508 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can not retrieve context items

Hi eb
I am adding in webForm1.aspx some item to the context items collection
in order to extract it in the next aspx page:

In webForm1.aspx - c# code behind - i do:
---------------------------------------------------------------
Context.Item.add("variableName",variableVaue);
//test that add item succeeded:
string test = (string)Context.Item["variableName"];
if (test.Equals(variableVaue))
{
Server.Transfer(webForm2.aspx,true);
}
----------------------------------------------------------------
Then in webForm2.aspx :

string strVar = (string)Context.Item["variableName"];
Here strVar is null...
--------------------------------------------------------------
If i do the same procedure with session object instead - it works.
What am i missing??

Thanks for your attention
Rea

Nov 18 '05 #1
2 1710
Context items only live for the life of the page requiest. they are
generally used to pass data between modules during a page request.

-- bruce (sqlwork.com)

"Rea Peleg" <re******@barak-online.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi eb
I am adding in webForm1.aspx some item to the context items collection
in order to extract it in the next aspx page:

In webForm1.aspx - c# code behind - i do:
---------------------------------------------------------------
Context.Item.add("variableName",variableVaue);
//test that add item succeeded:
string test = (string)Context.Item["variableName"];
if (test.Equals(variableVaue))
{
Server.Transfer(webForm2.aspx,true);
}
----------------------------------------------------------------
Then in webForm2.aspx :

string strVar = (string)Context.Item["variableName"];
Here strVar is null...
--------------------------------------------------------------
If i do the same procedure with session object instead - it works.
What am i missing??

Thanks for your attention
Rea

Nov 18 '05 #2
Interesting...
But I have seen a few examples of this nature in the internet.
This is where i got the idea from the first place.
What do you meen than by 'passing variables between modules'?
If these are code modules i can pass variables to them without the context
object at all..
What is your preffered method to passing variables between web forms?
Are there reasons not to do it with the good old session object?
I know one can use Server.Transfer("nextWebForm.aspx",true) to pass one
the request.querystring from current form to the next one, but have read
that
a bug in asp.NET mite cause an error here in some cases(?)
Thanks again for your answer
Rea


"bruce barker" <no***********@safeco.com> wrote in message
news:#K**************@TK2MSFTNGP12.phx.gbl...
Context items only live for the life of the page requiest. they are
generally used to pass data between modules during a page request.

-- bruce (sqlwork.com)

"Rea Peleg" <re******@barak-online.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi eb
I am adding in webForm1.aspx some item to the context items collection
in order to extract it in the next aspx page:

In webForm1.aspx - c# code behind - i do:
---------------------------------------------------------------
Context.Item.add("variableName",variableVaue);
//test that add item succeeded:
string test = (string)Context.Item["variableName"];
if (test.Equals(variableVaue))
{
Server.Transfer(webForm2.aspx,true);
}
----------------------------------------------------------------
Then in webForm2.aspx :

string strVar = (string)Context.Item["variableName"];
Here strVar is null...
--------------------------------------------------------------
If i do the same procedure with session object instead - it works.
What am i missing??

Thanks for your attention
Rea


Nov 18 '05 #3

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

Similar topics

0
1710
by: Chung Leong | last post by:
My contribution to the comp.lang.php FAQ: ------------------------------------------------------------- Q: How do I retrieve a page from a web site? A: Pass a URL to file() or...
5
11183
by: David Rasmussen | last post by:
Some sites seem to be session driven in the sense that if I visit the homepage and do a few clicks I can navigate anywhere I want, but if I paste the current location into a new browser window...
8
10070
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
2
1692
by: dave | last post by:
This little problem is driving me nuts!! On my webform page I create 2 variables.. Protected p_dml As String = "I" Public Const mwv_id As Integer = 0 ' originally had mwv_id as Protected
4
2127
by: nicholas | last post by:
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)...
4
1292
by: Hugo Flores | last post by:
Often people post questions about how did they loose their context between pages, and the more common cause is that they don't store the context on the viewstate upon postbacks. Mine is the other...
1
6324
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
2
5891
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more...
1
3650
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
0
7228
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
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
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
5635
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,...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.