473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

share enum between pages?

I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?

tia
Chris
Sep 17 '08 #1
8 2289
The same way as you would anything else that you want to access from other
pages. Just make sure it is not declared as part of the class for the page,
it can be easy to accidentally make an enum part of the page when you don't
want to. Or if you would like you can simply stick it in a separate file,
this might help you keep it organized as not being part of the codebehind.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"oaksong" <oa*****@hotmail.comwrote in message
news:32**********************************@d45g2000 hsc.googlegroups.com...
I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?

tia
Chris

Sep 18 '08 #2
this is a bad practice. pages should not access each other. the proper
way is to move the enum to a class file in the app code folder.

-- bruce (sqlwork.com)
oaksong wrote:
I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?

tia
Chris
Sep 18 '08 #3
On Sep 17, 8:45*pm, bruce barker <nos...@nospam.comwrote:
this is a bad practice. pages should not access each other. the proper
way is to move the enum to a class file in the app code folder.

-- bruce (sqlwork.com)

oaksong wrote:
I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?
tia
Chris
I have a class file in the app code folder. I put the enum into that
file. When I tried to reference it from a codebehind page it produced
an error.
Sep 18 '08 #4
On Sep 18, 11:36*am, oaksong <oaks...@hotmail.comwrote:
On Sep 17, 8:45*pm, bruce barker <nos...@nospam.comwrote:
this is a bad practice. pages should not access each other. the proper
way is to move the enum to a class file in the app code folder.
-- bruce (sqlwork.com)
oaksong wrote:
I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?
tia
Chris

I have a class file in the app code folder. I put the enum into that
file. When I tried to reference it from a codebehind page it produced
an error.
What was the error? (nobody can help you if you just say "an error")
Sep 18 '08 #5
On Sep 18, 1:52*pm, Norm <neon...@gmail.comwrote:
On Sep 18, 11:36*am, oaksong <oaks...@hotmail.comwrote:


On Sep 17, 8:45*pm, bruce barker <nos...@nospam.comwrote:
this is a bad practice. pages should not access each other. the proper
way is to move the enum to a class file in the app code folder.
-- bruce (sqlwork.com)
oaksong wrote:
I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?
tia
Chris
I have a class file in the app code folder. I put the enum into that
file. When I tried to reference it from a codebehind page it produced
an error.

What was the error? (nobody can help you if you just say "an error")- Hide quoted text -

- Show quoted text -
The enum is named 'cpage'.
The error is: error BC30451: Name 'cPage' is not declared.
Sep 18 '08 #6
On Sep 18, 11:55*am, oaksong <oaks...@hotmail.comwrote:
On Sep 18, 1:52*pm, Norm <neon...@gmail.comwrote:
On Sep 18, 11:36*am, oaksong <oaks...@hotmail.comwrote:
On Sep 17, 8:45*pm, bruce barker <nos...@nospam.comwrote:
this is a bad practice. pages should not access each other. the proper
way is to move the enum to a class file in the app code folder.
-- bruce (sqlwork.com)
oaksong wrote:
I've got an enum in a code behind page. It's set as public enum. How
do I access it from another page?
tia
Chris
I have a class file in the app code folder. I put the enum into that
file. When I tried to reference it from a codebehind page it produced
an error.
What was the error? (nobody can help you if you just say "an error")- Hide quoted text -
- Show quoted text -

The enum is named 'cpage'.
The error is: error BC30451: Name 'cPage' is not declared.
The error means (I'm pretty sure) that the enum is not in scope.
Without code, It's hard to diagnose. Here are some tips:

1. Is the enum inside of a class and/or namespace?
1.1 If in a class, is it declared "Public"?
1.2 If in a namespace, is the namespace imported in the page that you
are attempting to access it?

Note: If you do end up finding the problem, make sure you post it so
other people know the fix.
Sep 18 '08 #7
oaksong wrote :
The enum is named 'cpage'.
The error is: error BC30451: Name 'cPage' is not declared.
Are you using C#? That is case-sensitive, so "cpage" and "cPage" are
different things.

Hans Kesting
Sep 19 '08 #8
On Sep 18, 2:08*pm, Norm <neon...@gmail.comwrote:
On Sep 18, 11:55*am, oaksong <oaks...@hotmail.comwrote:
On Sep 18, 1:52*pm, Norm <neon...@gmail.comwrote:
On Sep 18, 11:36*am, oaksong <oaks...@hotmail.comwrote:
On Sep 17, 8:45*pm, bruce barker <nos...@nospam.comwrote:
this is a bad practice. pages should not access each other. the proper
way is to move the enum to a class file in the app code folder.
-- bruce (sqlwork.com)
oaksong wrote:
I've got an enum in a code behind page. It's set as public enum.. How
do I access it from another page?
tia
Chris
I have a class file in the app code folder. I put the enum into that
file. When I tried to reference it from a codebehind page it produced
an error.
What was the error? (nobody can help you if you just say "an error")-Hide quoted text -
- Show quoted text -
The enum is named 'cpage'.
The error is: error BC30451: Name 'cPage' is not declared.

The error means (I'm pretty sure) that the enum is not in scope.
Without code, It's hard to diagnose. Here are some tips:

1. Is the enum inside of a class and/or namespace?
1.1 If in a class, is it declared "Public"?
1.2 If in a namespace, is the namespace imported in the page that you
are attempting to access it?

Note: If you do end up finding the problem, make sure you post it so
other people know the fix.
The reference was out of scope. I needed to import my enums class.
Thanks!
Sep 19 '08 #9

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

Similar topics

7
by: Charles Crume | last post by:
Hello all; I have used dBASE, and other computer languages/databases, for years. They all have a logical field type. However, the version of MySQL used by the ISP hosting my site does not...
4
by: Pierre Couderc | last post by:
I want to share enum between 2 classes C1 and C2: class C1 { public: enum shut {AAA,BBB, CCC}; shut m_C1; void set(shut &s) { m_C1=s;} };
3
by: Jon Paugh | last post by:
Hi, If I have several aspx pages that I want to share across multiple web applications, how would I organize them? Basically, a subset of the pages on a given site will be on several sites....
2
by: tony collier | last post by:
I have the following in one of my .aspx pages: ..... <script runat="server"> enum bookstores { Amazon,
2
by: P K | last post by:
Hi, I have an Enum which I need to use in many pages and many classes written in asp.net 2.0 I would like to have a central repository for the enum so that changes can be made once. Also I would...
4
by: moondaddy | last post by:
I have some pubic Enums I like to use throughout my application. Now I'm parsing the application out into smaller DLLs or projects. How an I share a common Enum across all the projects? ...
5
by: Joe | last post by:
I have an application which runs in a non-secure environment. I also have an application that runs in a secure environment (both on the same machine). Is there any way to share the session data for...
0
by: aloneplayer | last post by:
Hi, All, I wrote a function to share a folder to individual user account with WMI. When I call it : ShareFolder("c:\\test", "Test", "Shared by Riven", 8, Environment.MachineName,...
0
by: rkr31 | last post by:
Hi I have an iis6 webserver serving pages from a clustered share. classc asp and html pages work ok but it will not serve aspx pages. When i try i get the following error: Server...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.