473,782 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Variable Scope / Visibility

If I create two aspx pages, place three text boxes (working with VS .net
2003 and web form controls) and a button on both forms.

On the first page, the button is set to use the "onClick" to open the second
page using Window.Open with the values being passed to the second page by a
global variable created in a Module added to the project, by the use of an
Application variable and by the use of a session variable.

In the page load of the second form the values of the text boxes are set to
these passed values.

When I run this as a single instance all works fine. If from another
machine I now open this web site, while still having the first instance open
then the data displayed on the second page reflects the first instances data
for the global variable and the application variable, the session variables
data is blank. If I right click and perform a refresh the data become
correct.

I assume this must be something to do with caching.

Can anyone advise?

Steve Wark
First Pages Page_Load & Button Click
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Response.Expire s = -1

Button1.Attribu tes.Add("onClic k",
"window.open('w ebform2.aspx',' Title','width=9 50,height=610,l eft=100,top=100 ')")

End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

v1 = TextBox1.Text

Application("v2 ") = TextBox2.Text

Session("v3") = TextBox3.Text

End Sub
Second Pages Page_Load
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Response.Expire s = -1

Button1.Attribu tes.Add("onClic k", "window.close() ")

TextBox1.Text = v1

TextBox2.Text = Application("v2 ")

TextBox3.Text = Session("v3")

End Sub


Nov 19 '05 #1
0 1254

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

Similar topics

8
5342
by: Dennis Marks | last post by:
In the following function: function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document.theMenu.visibility = theAction;} else {document.all.theMenu.style.visibility = theAction;}} } Will the passed value of theMenu be substituted in the last 2 lines or
44
2038
by: Mohanasundaram | last post by:
int i = 10; int main() { int i = 20; return 0; } Hi All, I want to access the global variable i inside the main. Is there
8
3378
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an actual program. To me "scope" of the name of a function or object are the general rules for the areas of a program that can through a declaration, have "visibility."
14
2423
by: rahul8143 | last post by:
hello, To limit scope of a variable in a single file that is part of a large project that have several C files we use static variable right?then to limit any variable to function scope it should be declared as auto or anything else?
6
2154
by: Neelesh Bodas | last post by:
Hello All, I was just listing down various ways in which variables can be created and destroyed in C++. (On the lines of 10.4.3 TC++PL Ed 3) Putting the summary here for corrections, comments, criticism, advices, improvements. Abbreviation: Created (C)
5
16402
by: John Kelsey | last post by:
Back in the "old" C/C++ days, I used to declare static variables inside functions. Something like... // just a silly example to demonstrate the technique int foo(void) { static int NextVal = 0; NextVal = (++NextVal) % 317; return (NextVal); }
18
33898
by: Jack | last post by:
Thanks.
10
12807
by: John Passaniti | last post by:
(Note: This is not the same message I posted a week or so ago. The problem that prevented my previous attempt to work was a silly error in the template system I was using. This is a problem involving variable scope in JavaScript.) I have a lot of code that generates HTML on the fly. This code has tags with id attributes derived from variables. A small example: blah('<span id="' + dev + '_' + mod + '">...</span>');
5
2238
by: somenath | last post by:
Hi All , I have one question regarding scope and lifetime of variable. #include <stdio.h> int main(int argc, char *argv) { int *intp = NULL; char *sptr = NULL;
112
5481
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions that may print some messages. foo(...) { if (!silent)
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.