web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to return the enum value and description from a base enum and populate a dropdownlist in ASP.Net

(0) ShareShare
ReportReport
Posted on by 790

I'm new to AX development.  I am using AX 2012.  I have a class which is used by a web service to expose it's methods to an ASP.Net web site project.  The web service works fine.

On my web page, I have a dropdownlist control.  I want to create a method in my AX class which will return a list that populates my dropdownlist control.  I have not used enums and I'm not sure how to do this.  So I want to return rows of enums / descriptions that will populate my ASP.Net dropdownlist control.  How can I do this?

*This post is locked for comments

I have the same question (0)
  • Denis Macchinetti Profile Picture
    16,444 on at

    Hi Robert

    In the link below, you can find the x++ code for get values of base enums.

    arsalanax.blogspot.it/.../get-values-of-base-enums-using-code-in.html

    You can create a list of elements to return to your ASP.net application.

  • Robert Herrmann Profile Picture
    790 on at

    Hi Denis,

    I verified your answer a week or 2 ago but I actually have a syntax error when I use the code in the link you provided.  Here is my code:

    private void getTareTypes()

    {

       EnumId     enumId = enumNum(wfsTareType);

       DictEnum  dictEnum = new DictEnum(enumId);

       int                count   = dictEnum.values();

       int                counter;

       for(counter = 0; counter < count; counter ++)

       {

           dictEnum.name(counter);

       }

    This line is underlined in red and says there is a syntax error:

       int                count   = dictEnum.values();

    So what I am I doing wrong?

  • Suggested answer
    Martin Dráb Profile Picture
    239,178 Most Valuable Professional on at

    AX 2012 offers the Metadata service for this purpose, namely operations GetEnumMetadataByID and GetEnumMetadataByName. You'll get EnumMetadata object and you'll find enum elements in Entries.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans