473,763 Members | 9,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remembering values between postbacks

I have 2 private variables in my class that I need to remember the values of
between postbacks (or actually callbacks, since I am using AJAX). I want to
avoid using session variables, if possible. Is there any other way to have
VB.NET maintain the values of these variables between postbacks & callbacks?
Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Aug 20 '07 #1
4 2524
ViewState

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Nathan Sokalski" <nj********@hot mail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I have 2 private variables in my class that I need to remember the values
of between postbacks (or actually callbacks, since I am using AJAX). I want
to avoid using session variables, if possible. Is there any other way to
have VB.NET maintain the values of these variables between postbacks &
callbacks? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Aug 20 '07 #2
Eliyahu,

Is this not putting the horse behind the car, using ajax and then send the
variables over the line?

This is more ment for Nathan than for you.

Cor

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgsch reef in
bericht news:u9******** ******@TK2MSFTN GP02.phx.gbl...
ViewState

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Nathan Sokalski" <nj********@hot mail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>I have 2 private variables in my class that I need to remember the values
of between postbacks (or actually callbacks, since I am using AJAX). I
want to avoid using session variables, if possible. Is there any other way
to have VB.NET maintain the values of these variables between postbacks &
callbacks? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Aug 20 '07 #3
I'd suggest you use ViewState in this situation.
Here are some other options, though:
http://SteveOrr.net/articles/PassData.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Nathan Sokalski" <nj********@hot mail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I have 2 private variables in my class that I need to remember the values
of between postbacks (or actually callbacks, since I am using AJAX). I want
to avoid using session variables, if possible. Is there any other way to
have VB.NET maintain the values of these variables between postbacks &
callbacks? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Aug 20 '07 #4
Re Is there any other way
>to have VB.NET maintain the values of these variables between postbacks
&
>callbacks?
I think the OP has to state clearly whether he is planning on postbacks or
callbacks. ViewState is obviously good for postbacks. This thread may help
for ViewState between callbacks:

http://forums.asp.net/p/1128218/1781727.aspx#1781727

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Cor Ligthert[MVP]" <no************ @planet.nlwrote in message
news:84******** *************** ***********@mic rosoft.com...
Eliyahu,

Is this not putting the horse behind the car, using ajax and then send the
variables over the line?

This is more ment for Nathan than for you.

Cor

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgsch reef in
bericht news:u9******** ******@TK2MSFTN GP02.phx.gbl...
ViewState

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Nathan Sokalski" <nj********@hot mail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I have 2 private variables in my class that I need to remember the
values
>of between postbacks (or actually callbacks, since I am using AJAX). I
want to avoid using session variables, if possible. Is there any other
way
>to have VB.NET maintain the values of these variables between postbacks
&
>callbacks? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Aug 20 '07 #5

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

Similar topics

4
1584
by: Ben Barter | last post by:
We have found a fundemental problem with the way that postbacks are handled. We have a page that has about 60 postback controls that are posted back to the server when the user clicks a link (LinkButton). The page takes about 5 seconds to render. A problem occurs when the user clicks the link, gets the page back to the browser, then immediately clicks the postback link again. In this situation the page has not finished rendering, but
1
2367
by: dwa | last post by:
All, We're trying to determine how to deal with password fields losing their state on a post back. We've got a form that implements post backs to carry out server side processing. As a result of the post back, passwords entered by the user lose their values and the user gets an error message upon final validation when they submit. Here's an illustration:
6
4370
by: Neil | last post by:
Hi, I have an aspx page with a number of web controls on it and one of these is a cancel button. I want to check the page to see if the user has changed any of the controls, i..e typed some text in a textbox, changed a dropdown etc The reason I want to do this is when the user clicks cancel I want to notify them that their changes will be lost using a popup or something. My question is what is the best way to compare the page that...
0
1249
by: Davey P | last post by:
I have an asp.net table which I am populating with controls dynamically at runtime. The controls themselves get/set values in a datatable which is stored in viewstate over postbacks. Here is basically what I am doing: pull datatable out of viewstate for each row in datatable create tablerow create tablecells create controls
0
282
by: Robert Fitzpatrick | last post by:
Running 7.4.2, I have a pl/pgsql function with a WHILE LOOP that inserts records a set number of times. Each time, the function generates a random number and INSERT INTO a table, if that number has been used already, I need to enter all fields leaving the incremented number NULL. How can I keep track of the numbers already used, does it support arrays and them? I tried a SELECT INTO (shown below), but I guess the INSERT does not commit...
3
1143
by: steven scaife | last post by:
I have written a class that stores some values in a class. I want to instantiate this on page load or whichever event is appropriate. However when the page postbacks i want to use the first instantiation of the class until i submit the page through the submit button. However i cant get it to pass the class through subsequent requests. Can anyone help me out with either samples or websites that can help me out thanks in advance
0
1029
by: Piotrek \Alchemik\ | last post by:
Hello, i have a small problem with an operation and remembering values after postback. I have imagemap, where i have some hotspots. After click i'd like to reload image with different one and create new hotspots on him. And i want to remember which photo is going next, so i create extra method with static fields and i store datas there, but the problem i have is that this datas are remembered after closing ie and restarting server. I...
0
1112
by: Piotrek \Alchemik\ | last post by:
Hello, i have a problem. I created photo as imagemap and i'd like to create hotspots location depending on some values. So at start i have static class where i put all values: class ExtraMethods { public static int xWaw = { 230, 130, 230, 230, 120 }; public static int yWaw = { 260, 530, 480, 100, 160 }; }
4
1217
by: Nathan Sokalski | last post by:
I have 2 private variables in my class that I need to remember the values of between postbacks (or actually callbacks, since I am using AJAX). I want to avoid using session variables, if possible. Is there any other way to have VB.NET maintain the values of these variables between postbacks & callbacks? Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
0
9564
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
9387
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
10148
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...
1
9938
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,...
0
9823
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 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...
0
8822
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, 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...
0
6643
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();...
1
3917
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
2
3528
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.