Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6736519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:08:20+00:00 2026-05-26T11:08:20+00:00

I have an enum called SiteTypes that contains several values that are all bound

  • 0

I have an enum called SiteTypes that contains several values that are all bound to a dropdown list. On the client side, I need to check this dropdown to see if the selected value is one of those enum values. I don’t want to hardcode the value of the enum in the script in case it needs to change, so I want to use a server tag to get it directly from the enum itself. Conecptually, I would like to do this:

function SiteIdChanged() {
    var x = "<%=SiteTypes.Employee %>";
}

The way I am doing it now is created a protected property in the codebehind that returns that specific enum value and am doing this:

function SiteIdChanged() {
    var x = "<%=EmployeeSiteTypeValue %>";
}

I don’t like that, though, because I have to create a special property on every page that I need to do such a check.

Is there a way to do what I want here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:08:20+00:00Added an answer on May 26, 2026 at 11:08 am

    Are you getting a “xxx is inaccessible due to its protection level” error when you compile or run the page? enums are public by default, classes are not. My guess is that you’ve defined your enum inside your page’s class and you aren’t explicitly marking it with the ‘public’ access modifier. Explicitly mark it as public or move it outside of the class and see what happens. If you’re planning on using it on lots of pages you should stick the enum definition in in a file in the App_Code folder of your project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have an Enum Called ActionStatus that has 2 possible values open=0 and closed
I have an enum called OrderStatus , and it contains various statuses that an
I am developing a program in VB.NET. I have an enum called PriceType that
I have a enum type called PaymentFrequency whose values indicate how many payments per
I have an Enum called Status defined as such: public enum Status { VALID(valid),
I have an enum that looks as follows: public enum TransactionStatus { Open =
If I defined a ENUM in a base object with several default values. When
Lets say I have a simple Enum called Animal defined as: public enum Animal
I have a data access class with an Enum called Salutation: public enum Salutation
I have an enum, suppose it is called sports: enum Sports { Baseball =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.