MS Dynamics Ax 2009 EP Development – Part 1

This article is for understanding what’s going on behind the scene when you want to do Microsoft Dynamics Ax 2009 Enterprise Portal (EP) customization. This article also explains how to start with the EP development using Visual Studio 2008 (recommended method of doing all new EP development).

When you customize EP or do new development, you perform actions on Windows SharePoint Services, AOT & Visual Studio.
EP can be used with WSS or with MOSS. Basic tasks of customization & development like creating new pages or adding Web parts to existing pages are all performed directly in Windows SharePoint Services.
The resources for EP are stored in the AOT. Some development tasks are performed directly in the AOT, such as defining data sets, business logic, security, site structure, and navigation for EP.

Most of the complex functionality of EP is developed by using Visual Studio 2008. You do EP development by using the Enterprise Portal framework and Visual Studio. You can use this framework and Visual Studio to customize existing controls for EP or to create new controls. EP functionality is deployed by creating managed User Controls in Visual Studio. Adding or modifying the code for User Controls in EP is like editing code for standard ASP.NET controls
I think as of now, you must be knowing what is required from you to do EP development. You should know how to code in X++, basic SharePoint development and should be familiar with C# coding. In this article also, I will not write code in detail but would expact that you know how to write it. 🙂
Start development:
I will walk through on editing the already created User Control in this article. I will use AxDataSource, AxSection, AxForm & AxGroup controls for this modification.
We need to modify an EP page which shows data in Parent-Child relationship form. We will add one more section in between which will show records from another new table related to the Parent table.

Step 1: Ax AOT development

To use a new table in EP, we need to create a data set for our table as EP uses data sets as the primary way to access Ax data.
Declare a variable (relatedFieldValue) in class declaration to hold the parent key value.
Create a method which will accept the related parent field value and if that record does not exists in Ax it will create a new record for the related field value than do execute query on the table. Name this method as DataSetMethodName1, we will use this in Step 3.
Code sample:

void setRelatedField(String _relatedFieldValue)
    NewTable    newTable;
        timesheetTable = NewTable::find(_relatedFieldValue);
        relatedFieldValue = _relatedFieldValue;
        element.CreateRecord();//if not exist
In NewTable.ExecuteQuery() use relatedFieldValue to filter the record.

Step 2: Create a Visual Studio Web Project

Typically, you will create one project for each set of User Controls used on a page in EP.
  • Start Visual Studio.
  • In the File menu, click New, and then click Web Site.
  • In the New Web Site window, select .NET Framework 2.0 as the framework version to use.
  • Set the Location to File System and the Language to Visual C#.
  • Choose Dynamics AX Web Project as the template to use. If you do not see this project template, be sure that you have the EP Tools installed. These tools include three components… Visual Studio add-in, Project templates & Toolbox components. When EP Tools are installed for Visual Studio, the Visual Studio environment is automatically reconfigured to make the tools available.
  • Specify the name and location of the folder where you want to store the files for the Web project.
  • Click OK to create the Web project.
  • If a dialog box displays asking whether to upgrade the Web site to the .NET Framework version 3.5, click No.

Step 3: Modify User Control

  1. Find the User Control to modify
    You must find the name of the specific User Control in EP before you can edit it.

    • In EP, navigate to the page that contains the Dynamics User Control Web part that you want to modify.
    • In the Site Actions menu, choose Edit Page.
    • In the Edit menu for the Web part, choose Modify Shared Web Part. The properties and settings for the Web part displays.
    • Examine the Managed content item property. This is the User Control that you want to modify.
  2. Modify the User Control
    Edit the user control found in above step in Visual Studio.

    • Start Visual Studio.
    • Open the Web project that you created in Step 2: Create a Visual Studio Web Project to use to modify the User Control.
    • Right-click the Web site in Solution Explorer, and then click Add User Control from AOT. The Pick Web Controls window displays.
    • Locate the User Control in the User Controls list and move it into the Selected Controls list.
    • Click OK to add the User Control (.ascx file) to the Web project.
      • Open the .ascx file. Check the tools available for Dynamics Ax in the toolbar.
      • Add AxDataSource (provides access to a data set in the AOT) from the Dynamics ax toolbar

        Choose the data set created in Ax in step 1.

      • Add AxSection (container for groups of other controls) at the desired location. For this example add this below Overview section.
      • Add AxForm (displays data from an AxDataSource in a form layout for a User Control) and set data source to the name of AxDataSource added above.
        Optionaly you can set DataKeyNames property to the RecId,PrimaryKey.
        Set From’s display mode by AxForm.ChangeMode() function in the code at the time of page_load.
      • Add AxGroup (container for fields in a form) and in it’s Fields property, select bounded fields to be displayed on the form.
      • Add a button to update the form data. And on it’s button clicked event add axForm1.UpdateItem(true); 
      • See, till now we have not linked our datasource to the page’s main data record.
        For this add this code in page_load event:
        RunDataSetMethod(this, axDataSource1, “DataSetMethodName1”, RelatedRecId);

    Add one new method in the User Control. This method will give you an idea on how to call Ax methods from .Net using new Ax .Net Framework.

I hope this article helped you starting the Dynamics Ax 2009 EP development. In my next article I will explain how to create a new User Control.

If you liked the story and want to see more of this kind of content, please follow our twitter handle @CursorRun or FB page @CursorRun
Share your love
Default image
Rahul Sharma
Rahul is a technology enthusiast, solutions architect, trainer, and blogger, working on various Microsoft and open source solutions with more than 18 years of industry experience. He specially takes interest in designing enterprise applications, cloud integrations, IoT, and other architecture rich business solutions. Rahul is a guest author with us and shares his knowledge through technology blog posts.
Articles: 59


Enter your email address below to subscribe to our website. We will never flood your inbox with unwanted emails & you can always unsubscribe anytime.


  1. Refresh Schema of your AxDataSource in .Net

  2. This is great but if I wanted to update the data set in AX and add a new table to it how can that new table show up in Visual Studio so I can use those fields on the webform?

  3. Hi rahul,
    A good article on how to modify user control. One thing what the changed I did in my own user control, the changes are not getting reflected on a page. I tried to search the page physical location but I couldn't get it, can you tell me the physical location or tell me the way how to see the updated user control on a page.

Leave a Reply

%d bloggers like this: