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 905225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:10:57+00:00 2026-05-15T16:10:57+00:00

I have an enum: public enum Status { Incomplete = 1, Complete = 2,

  • 0

I have an enum:

public enum Status 
{ 
    Incomplete = 1, Complete = 2, Cancelled = 3, Deleted = 4 
}

Now on a certain page I wish to list this enum in a checkboxlist. This would be fine except that I want the text of each checkbox to display different text than the enum.

i.e the check boxes should say:

“Not Processed” instead of “Incomplete”

“Processed” instead of “Complete”

“Void” instead of “Cancelled”

Is it possible to put this enum in a foreach and then switch on the status and update the text. Like so:

var statuses = Enum.GetNames(typeof(Status));
foreach (var status in statuses)))
{
    switch (status)
    {
        case Status.Complete.ToString(): 
        status = "Processed";
        break; ...etc                 
    }
}

Any ideas would be greatly appreciated.

  • 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-15T16:10:58+00:00Added an answer on May 15, 2026 at 4:10 pm

    C# has a language feature that directly addresses your question. Here’s an article that gives you the complete details.

    The short version: apply extension attribute values to each value:

    enum OrderStatus  
    {  
        [EnumValueData(Name="New Order")]  
        NewOrder = 1,  
        [EnumValueData(Name="In Process")]  
        Processing = 2,  
        [EnumValueData(Name="Shipped")]  
        Shipped = 3  
    }  
    

    Then apply said values to your radio-buttons, listbox or whatever:

    public static Dictionary<int, string> GetListItems(Type enumType)  
    {  
        if (!enumType.IsEnum)  
            throw new ApplicationException("GetListItems does not support non-enum types");  
        Dictionary<int, string> list = new Dictionary<int, string>();  
        foreach(FieldInfo field in enumType.GetFields(BindingFlags.Static | BindingFlags.GetField | BindingFlags.Public))  
        {  
            int value;  
            string display;  
            value = (int)field.GetValue(null);  
            display = Enum.GetName(enumType, value);  
            foreach(Attribute currAttr in field.GetCustomAttributes(true))  
            {  
                EnumValueDataAttribute valueAttribute = currAttr as EnumValueDataAttribute;  
                if (valueAttribute != null)  
                    display = valueAttribute.Name;  
            }  
            list.Add(value, display);  
        }  
        return list;  
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Enum like this written in Java: public enum Status { ACTIVE(Active),
In java I have: public class MyClass{ public enum STATUS { ZERO, ONE ,
I have enum like this [Flags] public enum Key { None = 0, A
I have enum like this: public enum ObectTypes { TypeOne, TypeTwo, TypeThree, ... TypeTwenty
Suppose I have this enum: public enum TestEnum { EXAMPLE, FURTHER_EXAMPLE, LAST_EXAMPLE } With
I have this property: public SubjectStatus Status { get { return status; } set
I have an Enum called Status defined as such: public enum Status { VALID(valid),
I have the following enum: public enum Status implements StringEnum{ ONLINE(on),OFFLINE(off); private String status
I have an enum class named Status as follows public enum Status { PENDING(0),
Imagine I have defined the following Enum: public enum Status : byte { Inactive

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.