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

  • SEARCH
  • Home
  • 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 4026660
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:59:55+00:00 2026-05-20T10:59:55+00:00

I am drawing a blank here.. I am using MVC and my model doesn’t

  • 0

I am drawing a blank here.. I am using MVC and my model doesn’t have the Value Name, it just has the ID.

The problem is with ‘itm.DegreeTypeId’ it is just an int. But I need to match it up with a string name.. so DegreeTypeId 1 = Associates Degree, 2 = Bachelor, 3 = MBA etc.

I don’t want to update the model to have the name, but instead to a quick lookup. What’s the best way to proceed here? I know I can create a method and have it return the string based on a number but there has to be a better cleaner way.

        string education = string.Empty;
        int eduCount = 0;
        foreach (var itm in candidate.Educations)
        {
            if (eduCount > 0) education += "<br><br>";
            education += string.Format("<b>{0}</b><br>{1} {2}<br>{3}Graduated: {4}<br>",
                                      itm.DegreeTypeId,
                                      itm.InstitutionName,
                                      itm.InstitutionLocation,
                                      itm.GraduatedOn.HasValue
                                          ? string.Format("{0:MMMM yyyy}", itm.GraduatedOn.Value)
                                          : string.Empty);
            eduCount++;
        }
  • 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-20T10:59:56+00:00Added an answer on May 20, 2026 at 10:59 am

    Try using a Dictionary

    static readonly Dictionary<int, string> Degrees = new Dictionary<int, string>() {
        {1, "Associates Degree"},
        {2, "Bachelor"},
        {3, "MBA"},
        ...
    };
    

    So the relevant snippet looks like this:

    education += string.Format("<b>{0}</b><br>{1} {2}<br>{3}Graduated: {4}<br>",
                                      Degrees(itm.DegreeTypeId),
                                      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a really stupid question, but I'm just drawing a blank here... What
I was a problem with drawing rectangle using mouse. I have solve my problem
I have a problem drawing something quickly in .NET. I don't think that any
After googling for a while I'm still drawing a blank here. I'm trying to
I'm drawing a blank here; I can't find it, unless I'm really overlooking something
I have a problem interoperating between system.drawing and WPF. To simplify this question I've
I am drawing a blank here for something that should be simple... I am
I think my mind is just drawing a blank, but basically, I want to
I'm working on drawing an SVG grid using Javascript. I've managed to get the
I'm doing custom drawing in datagridview cells and I have items that can vertically

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.