Dynamics Search Engine

Saturday, February 14, 2009

How to use User Controls within .Net to develop or customize Microsoft Dynamics Ax 2009 Enterprise Portal -Part I

Note: There is no warranty on this article. Use at your own risk.

This article explains how to develop or customize Microsoft Dynamics Ax 2009 Enterprise Portal using User Control. How to use Visual Studio (.Net) environment to develop/customize Microsoft Dynamics Ax 2009 Enterprise Portal. How to use Microsoft Dynamics Ax 2009 Data Sets within .Net environment. How to develop or customize Dynamics Ax 2009 Enterprise Portal.

To follow this article you should have installed:
  1. Microsoft Dynamics Ax 2009 with Enterprise Portal
  2. Enterprise Portal should be configured with Microsoft Windows Sharepoint Services 3.0 SP1 or Microsoft Windows Sharepoint Server 2007 SP1. A website for Enterprise Portal should be created
  3. Visual Studio 2008.
You should be familiar with
  • X++ Language
  • Microsoft Dynamics Ax 2009 customization
  • .Net development
  • Microsoft Windows Sharepoint Services product
Now I will explain step by step.

1. Open Microsoft Dynamics Ax 2009 application then AOT. Select Data Sets node, right click on it, and select New Data Set.

2. Rename it to SalesInfo (or any other name whatever you wish) as shown below:

3. Add SalesTable and CustTable to the Data Sources of SalesInfo Data Set as shown below. Make a join between these table.

4. Now open your Visual Studio, click on File->New->Web Site… as shown below

5. From web site template select Dynamics Ax Web Project template, Location should be File System, Language should be Visual C#, and .Net Framework 2.0 as shown below. Click on OK.

6. Now see the Solution window where a project has been created in the name “AxWebProject1”. You can rename it.

7. Right click on AxWebUserControl.ascx page in the solution window then click on View Designer as shown above.

8. Now open the Toolbox and find Dynamics Ax tool section. Drag and drop AxDataSource control from Toolbox to the body of the AxWebUserControl.ascx page.

9. Select the AxDataSource1 on the AxWebUserControl.ascx page then assign a DataSet to it from the AxDataSource Tasks dropdown as shown below. Here you need to select SalesInfo DataSet you created in step1.

10. Go to the Toolbox again and add AxGridView control from Toolbox to the AxWebUserControl.ascx form as shown below.

11.Add AxDataSource1 to AxGridView.

12.Now click on Edit Columns… on AxGridView Tasks.

You will get the below field designer.

13. Add those fields you want to display. I added AccountNum, Name, CustGroup and SalesTable!Status. Later on I modified the fields.

14. Now select the AxWebPartPage.aspx in the solution window. Right click on it. Select View Designer.

15. Now drag the AxWebUserControl.ascx page from solution window and drop it to the body of the AxWebPartPage.aspx. Press F5 to execute the page. See the data is being displayed from Ax in the internet explorer.

Grid format(Template) is also available. See step 12. Auto Format is there.

Now your newly created user control is available in Microsoft Dynamics Ax 2009 AOT. To check go to AOT->Web->Web Files->Web Controls->User Controls.

If it's not available in the AOT then you can add it to AOT.
Right click on .ascx control in the Sulution explorer then click on Add to AOT as shown below

Hope this will be helpful for you.
This is Part I.
In Part II I will let you know how to use this .Net made user control within Dynamics Ax 2009 Enterprise Portal (EP).


  1. Hello Sir,

    I'm very glad you have this kind of blog, it's very informative, by the way sir wen i was following your instruction i encounter a problem, when i right click in my solution explorer in Visual studio 2008 there is no "Add to AOT" button, what seems to be the problem? pls. help me sir, everything is working just fine in my VS I can connect to my AX09 dataset from VS2008 but the only problem is that there is no "Add to AOT" button.. pls help me.. thanks a lot..

  2. I do not see the "Add to AOT" button in my env. What do you think is the problem?

  3. I have the same problem as Srinivas. No option available for "Add to AOT". Any help?

  4. Hi Guys,
    When you create a new web site in VS using Dynamics Ax Web Projects template, it automatically creates a .ascx page. If you right click on this, it will show you the option "Add to AOT". You can add any user control from AOT in your project area. If you don't see the option "Add to AOT", it indicates number of things. May be you are not connected to correct AOS.
    Can you guys give me some details like how the environment you prepared? On the AOS server how many AOS is there? Is it a single system or multi? Which version of VS you are using to customize user control

  5. Hi all, today I had the same issue here. No "Add to AOT" option in VS.
    After some debugging I discovered I created a .NET Framework 3.5 website and not a .NET Framework 2.0. That was causing the issue.
    Hope it helps.

    greetz Geert

  6. If no "Add to AOT" option is available, or if the "Add user control for AOT" options are missing, it could be a problem with the Add-in. Occasionally, the Dynamics AX Enterprise Portal Tools Add-in on my development box is sometimes disabled in Visual Studio 2008. Verify that the Add-In is loaded by going to Tools, Add-in manager. If it is not checked, check it, close the dialog, close your solution, then reopen the solution.

    My biggest rant about working with Dynamics AX and Visual Studio revolves around the fact that too many applications are required to run locally to setup the development tools properly. We should be able to work with a remote installation of SharePoint, rather than have it on our development boxes. Just my rant though.