|
 |
aspx thread: Persistent Variables??
Message #1 by marl@s... on Wed, 16 Oct 2002 01:18:13
|
|
Hi:
I set some variables (C#):
protected string iLView;
protected string iList;
protected string UserID;
protected ArrayList arFlds;
and in a proc. set their values on initial application Page_Load().
The Web form displayed and i clicked a dropdown w/ autopostback which
called a proc that counted on the values in the vars being set.
The values that I had initially set were gone.
How do I use variables in a code behind page that I can keep.
I guess I'm asking, how the heck do I maintain state?
Message #2 by "Carole D. Sullivan" <carolesullivan@e...> on Wed, 16 Oct 2002 17:26:50
|
|
"Viewstate" allows you to store a hidden item and then retrieve it's
contents on postback, works great when attempting to maintain a sort on a
datagrid when paging as well.
under is not post back, store the field:
viewstate("strEmployeeName") = txtToStore
Retrieve it:
lblEmployeeName.Text = CStr(ViewState("strEmployeeName"))
> Hi:
> I set some variables (C#):
> protected string iLView;
> protected string iList;
> protected string UserID;
> protected ArrayList arFlds;
> and in a proc. set their values on initial application Page_Load().
> The Web form displayed and i clicked a dropdown w/ autopostback which
c> alled a proc that counted on the values in the vars being set.
> The values that I had initially set were gone.
> How do I use variables in a code behind page that I can keep.
I> guess I'm asking, how the heck do I maintain state?
Message #3 by "Marl Atkins" <marl@s...> on Wed, 16 Oct 2002 12:21:15 -0400
|
|
Thanks Carole:
Hmm, this looks like VB?
I did it a different way Session["MyVar"] = MyVar;
MyVar = Session["MyVar"].ToString();
I'll look into the Viewstate.
Again, thanks:-)
-----Original Message-----
From: Carole D. Sullivan [mailto:carolesullivan@e...]
Sent: Wednesday, October 16, 2002 5:27 PM
To: ASP+
Subject: [aspx] Re: Persistent Variables??
"Viewstate" allows you to store a hidden item and then retrieve it's
contents on postback, works great when attempting to maintain a sort on a
datagrid when paging as well.
under is not post back, store the field:
viewstate("strEmployeeName") = txtToStore
Retrieve it:
lblEmployeeName.Text = CStr(ViewState("strEmployeeName"))
> Hi:
> I set some variables (C#):
> protected string iLView;
> protected string iList;
> protected string UserID;
> protected ArrayList arFlds;
> and in a proc. set their values on initial application Page_Load().
> The Web form displayed and i clicked a dropdown w/ autopostback which
c> alled a proc that counted on the values in the vars being set.
> The values that I had initially set were gone.
> How do I use variables in a code behind page that I can keep.
I> guess I'm asking, how the heck do I maintain state?
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #4 by =?iso-8859-1?Q?S=E6mundur_Valdimarsson?= <saemund@h...> on Wed, 16 Oct 2002 17:12:23 -0000
|
|
I tried using the Viewstate but it doesn't seem to allow me to access it
accross different user controls even though they run in the same page.
-SV
-----Original Message-----
From: Carole D. Sullivan [mailto:carolesullivan@e...]
Sent: 16. okt=F3ber 2002 17:27
To: ASP+
Subject: [aspx] Re: Persistent Variables??
"Viewstate" allows you to store a hidden item and then retrieve it's
contents on postback, works great when attempting to maintain a sort on
a
datagrid when paging as well.
under is not post back, store the field:
viewstate("strEmployeeName") =3D txtToStore
Retrieve it:
lblEmployeeName.Text =3D CStr(ViewState("strEmployeeName"))
> Hi:
> I set some variables (C#):
> protected string iLView;
> protected string iList;
> protected string UserID;
> protected ArrayList arFlds;
> and in a proc. set their values on initial application Page_Load().
> The Web form displayed and i clicked a dropdown w/ autopostback which
c> alled a proc that counted on the values in the vars being set.
> The values that I had initially set were gone.
> How do I use variables in a code behind page that I can keep.
I> guess I'm asking, how the heck do I maintain state?
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
|
|
 |