Using AX Labels in EP 2009

The AX Label is a core component in the localization support in AX and thus also in EP 2009. There are three main ways you can use labels from the AX label system in EP:

  • Automatically as a result of the metadata driven UI
  • The AxLabel expression in markup
  • Looking up labels in code-behind

The first is the most prevalent one and it is also the easiest. Basically when the bound fields render in a data bound control like the AxGridView they will resolve the label associated with the field in AX automatically and render it. image

The second scenario is useful if you want to show a label in your UI but the UI is not data bound to a table field. For example you might add an ASP.NET button to the markup and you want the text of the button to come from a label. To do that you can use the AxLabel expression. The AxLabel is a standard ASP.NET Expression that is tailored to lookup the label when the page is rendered. To add the AxLabel expression I recommend using the ASP.NET Expression editor in Visual Studio. The expression editor is available in the design view of the user control. For this example add a Button control and then go to the properties of the button control and click the button that appears on the (Expressions) property. In the following dialog you select the control property that you want bind to the AxLabel expression on the left. Here I am binding the Text property of the button control. Type the label id and the expression will be executed and you should see the resolved label.

Alternatively you can type the expression directly in the markup. Go to the markup and you will see that the markup for the button control looks like this.


The final approach is to use the Labels class to lookup labels in code-behind. The code is pretty straight forward:


As a final note I would like to mention that EP will cache all labels for all languages in memory on the web server to improve performance. You can clear this cache by doing a Refresh AOD.

Comments (1)

  1. wenni057 says:

    i have some errors, on tutorials of EP code:

    The expession prefix ‘AxLabel’ was not recognized.

    at compulile time I get these errors:

    Error 12 System.Web.UI.WebControls.WizardStepCollection must have items of type ‘System.Web.UI.WebControls.WizardStepBase’. ‘table’ is of type ‘System.Web.UI.HtmlControls.HtmlTable’. C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2008WebSitesCreateCustomerTunnelCreateCustomerTunnel – FinalCreateCustomerTunnel.ascx 19

Skip to main content