Display friendly names for picklists/enums
XrmLinq has made it very easy to display picklist/enum values from the generated Dynamics CRM code.
As an example, let’s say you want to display the friendly names from the Account Industry Code picklist/enum. To do this call the ToList method of the CrmEnumAttribute class. For example:
Type enumType = typeof(Account.Enums.IndustryCode);
var items = CrmEnumAttribute.ToList(enumType);
Once you have the picklist/enum items in a generic list you can bind this to any control. For example, binding it to an asp.net dropdownlist
<asp:DropDownList ID=”IndustryCode” runat=”server” DataTextField=”DisplayName” DataValueField=”Value” />
Then in the code-behind of the aspx page
this.IndustryCode.DataSource = items;
this.IndustryCode.DataBind();




