Walkthrough: Adding a Field to a User Control

Dynamics AX 2009

Enterprise Portal contains several list pages that display data in list form. For example, the Customers list page displays a list of customers. A User Control displayed in a Dynamics User Control Web part is used to display the list. The AxGridView is the main component of the User Control used for the list.

A common customization is adding or changing the columns that are displayed in the list on a list page. This walkthrough demonstrates how to add a field to the customer list Web part on the Customers list page. It illustrates the following tasks:

  • Determining the User Control to modify.

  • Creating a Visual Studio Web project.

  • Adding a User Control to the Web project.

  • Modifying a User Control.

  • Viewing the customization in Enterprise Portal.

To complete this walkthrough, you will need:

  • Microsoft Dynamics AX

  • Enterprise Portal

  • Visual Studio 2008

  • Enterprise Portal Development Tools

  • Enterprise Portal Administrator status

Before you can modify the customer list, you must determine which User Control is being used for the list.

To determine the User Control to modify

  1. Using a Web browser, open Enterprise Portal. The typical URL to access Enterprise Portal is:


    Substitute the name of the server on which Enterprise Portal is installed.

  2. Display the Customers list page. Click Sales on the top link bar, and then click Customers on the Quick Launch to open the Customers page. The User Control with customer information is displayed.

  3. In the Site Actions menu, click Edit Page.

  4. Locate the CustomerList Web part in the middle column. In the edit menu for this Web part, click Modify Shared Web Part.

  5. In the list of properties for the Web part, locate the Managed content item property. It is set to CustomerListGrid, which is the User Control that is being displayed in the Web part. This is the User Control that will be modified.

  6. Click Cancel to close the list of Web part properties.

  7. Click Exit Edit Mode to return to the Customers page.

Visual Studio is used to modify User Controls for Enterprise Portal.

To create the Visual Studio Web project

  1. Start Visual Studio.

  2. In the File menu, click New, and then click Web Site.

  3. In the New Web Site window, select .NET Framework 2.0 as the framework version to use.

  4. Set the Location to File System and the Language to Visual C#.

  5. Choose Dynamics AX Web Project as the template to use.

  6. Specify the name and location of the folder where you want to store the files for the Web project.

  7. Click OK to create the Web project.

  8. If a dialog box displays asking whether to upgrade the Web site to the .NET Framework version 3.5, click No.

You must add the User Control to the Web project so that you can edit the User Control's properties.

To add the User Control to the Web project

  1. Right-click the Web site in Solution Explorer. The Web site is the second item in Solution Explorer, displayed under Solution.

  2. Click Add user control from AOT. The Pick Web Controls window will be displayed.

  3. In the Web Controls list, locate the CustomerListGrid control. Move it to the Selected Nodes list, and then click OK.

Use Visual Studio to make changes to the User Control.

To modify the User Control

  1. Locate the CustomerListGrid.ascx component in Solution Explorer.

  2. Right-click the CustomerListGrid component in Solution Explorer, and then click View Designer.

    After a few moments, you will see two components in the control layout. The AxDataSource component is used to access data for the customer list. The AxGridView displays the customer information in the grid.

  3. Click the grid view component directly in the layout to select it. You can also select the grid view component by selecting the AxGridView1 item from the drop-down at the top of the Properties list in Visual Studio.

  4. To modify the columns displayed in the grid, use one of the following methods:

    Display the context menu at the upper-right corner of the grid control in the layout. Click Edit Columns to display the Dynamics AX Bound Field Designer.


    Locate the Columns property in the Properties list. Click the ellipsis button to display the Dynamics AX Bound Field Designer.

  5. The Selected Field list contains the fields that appear in the grid. In the Available Fields list, locate the CreditMax field. Click Add Field to add this field to the list of fields that will be displayed in the grid.

  6. Optionally, you can use the up and down arrows to move the CreditMax field to a location other than the end of the grid.

  7. Click OK to save the changes to the list of fields.

  8. In the File menu, click Save CustomerListGrid.ascx to save the changes you made to the User Control. The changes will be exported automatically to the AOT so that they can be accessed by Enterprise Portal.

After the field has been added to the User Control, you can view it in Enterprise Portal.

To view the customization in Enterprise Portal

  1. Using a Web browser, open Enterprise Portal.

  2. Display the Customers list page. Click Sales on the top link bar, and then click Customers on the Quick Launch to open the Customers page. You will see the list of customers, including the additional column that you added.

To learn more about User Controls in Enterprise Portal, see User Controls Overview.

Community Additions