|
 |
aspx thread: Structures
Message #1 by "J Donahue" <jdonahue@f...> on Thu, 5 Sep 2002 00:05:56
|
|
I'm working on an asp.net application. I was hoping to use a structure
to hold some data. Can I declare my structure globally?? I tried to
declare it in Global.asax but it won't let me Dim an instance of it in my
various aspx and ascx files.
Since the structure would be used throughout the various aspx pages, I'd
like to declare it once globally.
Thanks...Jim
Message #2 by "Andrew Bradnan" <andrew@w...> on Wed, 4 Sep 2002 17:32:30 -0700
|
|
If you add it to your Global class you can get to it.
aspx....
<%=3D ApplicationInstance.m_sSomeVariable %>
in your code it hides under....
System.Web.HttpContext.Current.ApplicationInstance
Hope that helps,
Andrew
http://whirly.info
.NET forums for developers
-----Original Message-----
From: J Donahue [mailto:jdonahue@f...]
Sent: Wednesday, September 04, 2002 5:06 PM
To: ASP+
Subject: [aspx] Structures
I'm working on an asp.net application. I was hoping to use a structure
to hold some data. Can I declare my structure globally?? I tried to
declare it in Global.asax but it won't let me Dim an instance of it in
my
various aspx and ascx files.
Since the structure would be used throughout the various aspx pages, I'd
like to declare it once globally.
Thanks...Jim
---
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.
---
Message #3 by =?ks_c_5601-1987?B?wMy1v7n8?= <funnyfox@d...> on Thu, 5 Sep 2002 14:54:13 +0900
|
|
You can use Global.asax.
In a Global.asax Class, declared one shared(static) variable.
And then assign structure value into it's shared(static) variable
=3D> Global.MySharedVariable =3D MyStructure
Good Luck!
Dongbum Lee
.NETXPERT Solution Consultant. Microsoft MVP
-----Original Message-----
From: J Donahue [mailto:jdonahue@f...]
Sent: Thursday, September 05, 2002 9:06 AM
To: ASP+
Subject: [aspx] Structures
I'm working on an asp.net application. I was hoping to use a structure
to hold some data. Can I declare my structure globally?? I tried to
declare it in Global.asax but it won't let me Dim an instance of it in
my
various aspx and ascx files.
Since the structure would be used throughout the various aspx pages,
I'd
like to declare it once globally.
Thanks...Jim
---
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.
---
Message #4 by "J Donahue" <jdonahue@f...> on Thu, 5 Sep 2002 14:45:51
|
|
Thanks Andrew and Dongbum. I got Dongbums version working but I'm still
a little confused by Andrew's implementation.
if I have a structure in global.asax as such:
Public Structure MyStruct
Public Name As String
Public City As String
End Structure
How do I refer to an instance of that in my aspx page? I tried to do
something like the following:
<%@ ApplicationInstance???????? %>
Thanks All
> If you add it to your Global class you can get to it.
aspx....
<%=3D ApplicationInstance.m_sSomeVariable %>
in your code it hides under....
System.Web.HttpContext.Current.ApplicationInstance
Hope that helps,
Andrew
http://whirly.info
.NET forums for developers
-----Original Message-----
From: J Donahue [mailto:jdonahue@f...]
Sent: Wednesday, September 04, 2002 5:06 PM
To: ASP+
Subject: [aspx] Structures
I'm working on an asp.net application. I was hoping to use a structure
to hold some data. Can I declare my structure globally?? I tried to
declare it in Global.asax but it won't let me Dim an instance of it in
my
various aspx and ascx files.
Since the structure would be used throughout the various aspx pages, I'd
like to declare it once globally.
Thanks...Jim
---
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.
---
|
|
 |