Hi, I have a variable question in regards to my asp .net page.
I need to declare a variable whose value is readable/writable to all
of the subroutines of a specific page. So far I have one of two
problems.
The first is if I declare my variable right after the class
definition, then I can use it anywhere, but the value does not persist
from one subroutine to the next.
The second is if I declare the variable as shared right after the
class definition, then I can use the value anywhere, but if I have 2
users, on two different computers, then they are accessing the same
values. I don't want this to happen.
Can this be done without using sessionstate? Thanks all. 2 1266
A Page is an instance of the class System.Web.UI.P age, so you can declare a
Field in your code, and that will be globally accessible within the Page.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
<ma********@gma il.comwrote in message
news:11******** **************@ w1g2000hsg.goog legroups.com...
Hi, I have a variable question in regards to my asp .net page.
I need to declare a variable whose value is readable/writable to all
of the subroutines of a specific page. So far I have one of two
problems.
The first is if I declare my variable right after the class
definition, then I can use it anywhere, but the value does not persist
from one subroutine to the next.
The second is if I declare the variable as shared right after the
class definition, then I can use the value anywhere, but if I have 2
users, on two different computers, then they are accessing the same
values. I don't want this to happen.
Can this be done without using sessionstate? Thanks all.
On Apr 12, 1:18 pm, "Kevin Spencer" <unclechut...@n othinks.comwrot e:
A Page is an instance of the class System.Web.UI.P age, so you can declare a
Field in your code, and that will be globally accessible within the Page.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net
<mattdad...@gma il.comwrote in message
news:11******** **************@ w1g2000hsg.goog legroups.com...
Hi, I have a variable question in regards to my asp .net page.
I need to declare a variable whose value is readable/writable to all
of the subroutines of a specific page. So far I have one of two
problems.
The first is if I declare my variable right after the class
definition, then I can use it anywhere, but the value does not persist
from one subroutine to the next.
The second is if I declare the variable as shared right after the
class definition, then I can use the value anywhere, but if I have 2
users, on two different computers, then they are accessing the same
values. I don't want this to happen.
Can this be done without using sessionstate? Thanks all.
I don't understand how to "declare a field" in my code. Although, I
solved the issue by using some invisible controls on the page. I guess
this accomplishes what you are saying in its own way, though. Seems it
would be cleaner to do declare it in the code, though. Thanks for your
help. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Grant Wagner |
last post by:
Given the following working code:
function attributes() {
var attr1 = arguments || '_';
var attr2 = arguments || '_';
return (
function (el1, el2) {
var value1 = el1 + el1;
var value2 = el2 + el2;
if (value1 > value2) return 1;
|
by: Alex |
last post by:
could somebody tell me the difference between those two styles:
function abc(var1, var2){ /* logic in here */ }
and
abc = function(var1, var2){ /* logic in here */ };
When / why would I use one over the other?
|
by: Jeff B. |
last post by:
If an object implements the IDisposable interface, should I always call the
Dispose method or is just setting it to null and letting the GC handle it
sufficient? Here is the pattern I've been using but wasn't sure if it was
necessary:
DataAdapter da = null;
try {
// Some logic here...
} catch (Exception ex) {
|
by: Gery D. Dorazio |
last post by:
Gurus,
If a static variable is defined in a class what is the scope of the variable
resolved to for it to remain 'static'? For instance, lets say I create a
class library assembly that is strongly name which contains the class where
the static variable is defined. This library can be referenced by multiple
projects. I am fairly sure the static variable does not survive across the
application boundry but does it within the application...
|
by: Russ Chinoy |
last post by:
Hi,
This may be a totally newbie question, but I'm stumped.
If I have a function such as:
function DoSomething(strVarName) {
.....
}
| |
by: Ryan Pedersen |
last post by:
I have a small program that executes a single very long running
background thread today.
The scope of all variables in the method that is running in this
thread today are all local to the method. The method doesn't do
anything outside of its local scope.
My question... can I start up a 2nd (3rd, and 4th and so on) thread
running the same method? Is that safe?
|
by: Michael |
last post by:
Hi,
I am trying to pass a function an array of strings, but I am having trouble
getting the indexing to index the strings rather than the individual
characters of one of the strings.
I have declared an array as:
char *stringArray = {"one","two","three","a"};
When I pass the array using:
|
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;
|
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)
|
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;
|
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...
| |
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...
|
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |