Walkthrough: Quickly Creating and Deploying a User Control
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
When you develop User Controls for use in Enterprise Portal, you will want to see results quickly. That can help you determine whether your development activities are on the appropriate track. This walkthrough demonstrates how to use the features in Microsoft Dynamics AX that help you quickly create and deploy User Controls to Enterprise Portal. These features are especially helpful when you are prototyping an integration for Enterprise Portal. The walkthrough illustrates the following tasks:
Creating an EP Web Application project.
Creating a User Control.
Deploying the User Control.
Viewing the User Control in Enterprise Portal.
To complete this walkthrough, you will need:
Microsoft Dynamics AX
Visual Studio 2010
Visual Studio Tools from the Microsoft Dynamics AX installation
Enterprise Portal Administrator status
Creating the EP Web Application Project
Visual Studio is used to create User Controls for Enterprise Portal.
To create the EP Web Application project
Start Visual Studio. If User Account Control (UAC) is active, make sure you start Visual Studio with administrative privileges. To do this, right-click the shortcut for Visual Studio and then click Run as administrator.
In the File menu, click New, and then click Project.
In the New Project window, select .NET Framework 3.5 as the framework version to use.
For this release of Microsoft Dynamics AX, the EP Web Application project must target the .NET Framework 3.5 to work correctly.
In the Installed Templates list, select Microsoft Dynamics AX. If you do not see this project template, make sure that you have Visual Studio Tools for Microsoft Dynamics AX installed.
Choose the EP Web Application template.
Specify a name for the project, and the location of the folder where you want to store the files for the project.
Click OK to create the project.
Creating a User Control
For this walkthrough, you will create a User Control that displays a simple list of customers.
To create a User Control
In Visual Studio, use Solution Explorer to select the project you created.
In the Project menu, click Add New Item.
In the Add New Item window, expand the Visual C# group of installed templates.
Click Microsoft Dynamics AX, and then click the EP User Control template.
For the User Control name, type QuickCustomerList.ascx.
Click Add. The new User Control is added to the project.
In Solution Explorer, right-click QuickCustomerList.ascx and then click View Designer.
In the Toolbox, expand the Dynamics AX group. In that group, drag the AxDataSource component to the layout for the QuickCustomerList.
The context menu for the AxDataSource component will be displayed. Set the DataSet Name to CustomerList. This indicates the data set that will be used to retrieve data for the User Control.
In the Toolbox, expand the Dynamics AX group. In that group, drag the AxGridView component to the layout for the QuickCustomerList.
The context menu for the AxGridView component will be displayed. Set the Choose Data Source value for the grid to AxDataSource1. This indicates that the grid will access data from the AxDataSource component that you had added to the User Control layout.
In the context menu for the AxGridView component, click Edit Columns. The Bound Field Designer appears.
In the Bound Field Designer, use the Available Fields list to locate the name** field. Select this field, and then click Add Field.
Click OK to close the Bound Field Designer.
In the File menu, click Save All.
Deploying the User Control
After the User Control has been created and saved, you can deploy it to Enterprise Portal to verify its functionality. Microsoft Dynamics AX provides functionality to speed this process when you are quickly prototyping User Controls.
To deploy the User Control
Open the Microsoft Dynamics AX client with administrative privileges. To do this, you must right-click on the icon for Microsoft Dynamics AX and then click Run as administrator.
Open the Development Workspace.
Display the AOT.
In the AOT, expand the Web > Web Content > Managed node. This node contains all of the User Controls that have been defined for Enterprise Portal.
In the list of managed components, locate the QuickCustomerList node. This is the managed content node for the User Control that you just created.
Right-click the QuickCustomerList node, and then click Deploy to EP.
The Deploy to EP dialog box is displayed. Set the Web module lookup to Home\Sales to indicate that the new resources will be used in the Sales site for Enterprise Portal. Click OK.
Microsoft Dynamics AX creates a SharePoint page named QuickCustomerList that is located in the Sales site. This page contains the customer list User Control that you created. Microsoft Dynamics AX also creates a web menu item named QuickCustomerList that points to the new page. Click Close to close the Infolog.
Viewing the User Control in Enterprise Portal
After the page that contains the User Control has been created, you can view the page in Enterprise Portal.
To view the User Control in Enterprise Portal
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.
Click Sales on the top link bar to display the Sales module site. This is the site that you deployed the new page to.
In the Site Actions menu, click View All Site Content.
In the Document Libraries section, click Enterprise Portal. This is the document library that pages for the Sales site are stored in.
Locate the QuickCustomerList page in the list of pages for the Sales site. You will have to use the arrows at the bottom of the page to browse to see the additional pages in the site.
Click the link for the QuickCustomerList page to display it in Enterprise Portal. After a few moments, you should see a page that contains the User Control you created, displaying a list of the customers in the current company.
Recall that a web menu item was created when you deployed the User Control. Typically, you would add this web menu item to the navigation for Enterprise Portal, and then access the new page through standard Enterprise Portal navigation. See Page-level Navigation Overview or Walkthrough: Adding a Page to Navigation for more information about how to add the web menu item to the navigation.
How to: Create an EP Web Application Project