473,806 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

variable persistence

hey all,

is there a way to persist a client-side variable between postbacks?

thanks,
rodchar
Nov 19 '05 #1
8 1088
Rodchar,

You may store it in a cookie, in a database, in a text file, in viewstate,
or in a session variable. Which is the best would depend on the information
being stored.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
hey all,

is there a way to persist a client-side variable between postbacks?

thanks,
rodchar

Nov 19 '05 #2
how do i store a client-side variable in viewstate or session? i'm not sure
of the exact syntax to do this?

"S. Justin Gengo" wrote:
Rodchar,

You may store it in a cookie, in a database, in a text file, in viewstate,
or in a session variable. Which is the best would depend on the information
being stored.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
hey all,

is there a way to persist a client-side variable between postbacks?

thanks,
rodchar


Nov 19 '05 #3
rodchar,

To store in viewstate:

Viewstate.Add(" MyString", "This is my variable")
Viewstate.Add(" MyInt", 13)

To store in session:

Session.Add("My String", "This is my variable")
Session.Add("My Int", 13)

Where MyString and MyInt are the keys and then any object may be added as
the value.

To retrieve:

Dim MyString As String = Viewstate.Item( "MyString").toS tring
Dim MyInt As Int32 = CType(Viewstate .Item("MyInt"), Int32)

Dim MyString As String = Session.Item("M yString").toStr ing
Dim MyInt As Int32 = CType(Session.I tem("MyInt"), Int32)
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:4E******** *************** ***********@mic rosoft.com...
how do i store a client-side variable in viewstate or session? i'm not
sure
of the exact syntax to do this?

"S. Justin Gengo" wrote:
Rodchar,

You may store it in a cookie, in a database, in a text file, in
viewstate,
or in a session variable. Which is the best would depend on the
information
being stored.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
> hey all,
>
> is there a way to persist a client-side variable between postbacks?
>
> thanks,
> rodchar


Nov 19 '05 #4
You don't. Use either a cookie or a hidden textbox.

Eliyahu

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:4E******** *************** ***********@mic rosoft.com...
how do i store a client-side variable in viewstate or session? i'm not sure of the exact syntax to do this?

"S. Justin Gengo" wrote:
Rodchar,

You may store it in a cookie, in a database, in a text file, in viewstate, or in a session variable. Which is the best would depend on the information being stored.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
hey all,

is there a way to persist a client-side variable between postbacks?

thanks,
rodchar


Nov 19 '05 #5
I understood the OP asked how to do it from client side.

Eliyahu

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate. com> wrote in
message news:u2******** *****@TK2MSFTNG P15.phx.gbl...
rodchar,

To store in viewstate:

Viewstate.Add(" MyString", "This is my variable")
Viewstate.Add(" MyInt", 13)

To store in session:

Session.Add("My String", "This is my variable")
Session.Add("My Int", 13)

Where MyString and MyInt are the keys and then any object may be added as
the value.

To retrieve:

Dim MyString As String = Viewstate.Item( "MyString").toS tring
Dim MyInt As Int32 = CType(Viewstate .Item("MyInt"), Int32)

Dim MyString As String = Session.Item("M yString").toStr ing
Dim MyInt As Int32 = CType(Session.I tem("MyInt"), Int32)
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:4E******** *************** ***********@mic rosoft.com...
how do i store a client-side variable in viewstate or session? i'm not
sure
of the exact syntax to do this?

"S. Justin Gengo" wrote:
Rodchar,

You may store it in a cookie, in a database, in a text file, in
viewstate,
or in a session variable. Which is the best would depend on the
information
being stored.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:96******** *************** ***********@mic rosoft.com...
> hey all,
>
> is there a way to persist a client-side variable between postbacks?
>
> thanks,
> rodchar


Nov 19 '05 #6
Yes,

But if he posts back... It's no longer just client side is it? So what's the
point of limiting it to client side then? I'm just trying to understand why
not use a "server side solution". Of course if the variable needs to be
accessed again client-side then you're right, a hidden field or a cookie is
about the only choice. (Unless you get into Ajax).

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:Og******** ******@TK2MSFTN GP09.phx.gbl...
I understood the OP asked how to do it from client side.

Eliyahu

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate. com> wrote in
message news:u2******** *****@TK2MSFTNG P15.phx.gbl...
rodchar,

To store in viewstate:

Viewstate.Add(" MyString", "This is my variable")
Viewstate.Add(" MyInt", 13)

To store in session:

Session.Add("My String", "This is my variable")
Session.Add("My Int", 13)

Where MyString and MyInt are the keys and then any object may be added as
the value.

To retrieve:

Dim MyString As String = Viewstate.Item( "MyString").toS tring
Dim MyInt As Int32 = CType(Viewstate .Item("MyInt"), Int32)

Dim MyString As String = Session.Item("M yString").toStr ing
Dim MyInt As Int32 = CType(Session.I tem("MyInt"), Int32)
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:4E******** *************** ***********@mic rosoft.com...
> how do i store a client-side variable in viewstate or session? i'm not
> sure
> of the exact syntax to do this?
>
> "S. Justin Gengo" wrote:
>
>> Rodchar,
>>
>> You may store it in a cookie, in a database, in a text file, in
>> viewstate,
>> or in a session variable. Which is the best would depend on the
>> information
>> being stored.
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "rodchar" <ro*****@discus sions.microsoft .com> wrote in message
>> news:96******** *************** ***********@mic rosoft.com...
>> > hey all,
>> >
>> > is there a way to persist a client-side variable between postbacks?
>> >
>> > thanks,
>> > rodchar
>>
>>
>>



Nov 19 '05 #7
Using an hidden field you can transmit back and forth the value...

Where do you need this exactly ? (you could use a cookie if you need this
only client side and find this acceptable).
--
Patrice

"rodchar" <ro*****@discus sions.microsoft .com> a écrit dans le message de
news:96******** *************** ***********@mic rosoft.com...
hey all,

is there a way to persist a client-side variable between postbacks?

thanks,
rodchar

Nov 19 '05 #8
to store my javascript variable in viewstate, i had to use an html hidden
textbox which i converted to run at server and that seem to have work well,
thanks.

rodchar

"Patrice" wrote:
Using an hidden field you can transmit back and forth the value...

Where do you need this exactly ? (you could use a cookie if you need this
only client side and find this acceptable).
--
Patrice

"rodchar" <ro*****@discus sions.microsoft .com> a écrit dans le message de
news:96******** *************** ***********@mic rosoft.com...
hey all,

is there a way to persist a client-side variable between postbacks?

thanks,
rodchar


Nov 19 '05 #9

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

Similar topics

10
387
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in order to persist it. Is the session the best mechnism for persisiting this object Thanks everyone
5
1111
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in order to persist it. Is the session the best mechnism for persisiting this object Thanks everyone
5
2389
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in order to persist it. Is the session the best mechnism for persisiting this object Thanks everyone
2
2364
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence Layer. 1. With a broker layer, does this layer sit at the same level as the Business Layer? So to speak, the presentation layer has knowledge of
0
2402
myusernotyours
by: myusernotyours | last post by:
Hi all, Am trying to create a Java Desktop App that uses Java Persistence in Netbeans. The database is MS Access but I tried with Mysql and got the same error. When I run the app( Create the entity manager), I keep getting the following... Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: No Persistence provider for EntityManager named ReceiptingPU: The following providers:...
0
9719
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
10366
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
10371
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
10110
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...
1
7649
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
6877
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();...
0
5546
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.