473,781 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2307
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********@hotm ail.com
http://www.nathansokalski.com/

"oaksong" <oa*****@hotmai l.comwrote in message
news:32******** *************** ***********@d45 g2000hsc.google groups.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...@hotmai l.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...@hotmai l.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...@hotmai l.comwrote:
On Sep 18, 1:52*pm, Norm <neon...@gmail. comwrote:
On Sep 18, 11:36*am, oaksong <oaks...@hotmai l.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...@hotmai l.comwrote:
On Sep 18, 1:52*pm, Norm <neon...@gmail. comwrote:
On Sep 18, 11:36*am, oaksong <oaks...@hotmai l.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
2903
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 support a "logical" field type. It does support ENUM and I have set some up in a couple of tables that accept the values 'T' and 'F'. Sometimes they work like a logical field: if ($myrow) echo 'New';
4
3807
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
1478
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. These pages will interact with a database, check security, etc. I have seen this KB article: http://support.microsoft.com/default.aspx?kbid=324785
2
1257
by: tony collier | last post by:
I have the following in one of my .aspx pages: ..... <script runat="server"> enum bookstores { Amazon,
2
1639
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 like a global access to it, meaning any page should be able to access it. How can I achieve this ?
4
3304
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? Thanks. -- moondaddy@nospam.com
5
2175
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 this? Most of the site allows the user to add things to a cart (non-secure), once they choose to check-out, I need this information which was stored in the session to be read by the payment page(secured). Hope this makes sense. It's probably...
0
2590
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, "Administrator"); The folder will be shared, but nobody has permission to access it. (The share permissions list of this folder is empty) Could you help me?
0
1029
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 Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.
0
9639
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
9474
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
10143
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
10076
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
9939
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
8964
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...
1
7486
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
6729
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
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.