Create a simple EP User Control for Microsoft Dynamics AX 2012



Hi Readers,


Recently I worked on EP User Controls web part for Microsoft Dynamics AX 2012, and in this post I am giving you an example, which helps you to know about how we can create and deploy the user controls in EP site for Microsoft Dynamics AX 2012.

But before that, please ensure the following prerequisite you will need to complete the user control
  • Microsoft Dynamics AX 2012 with Enterprise Portal & Visual Studio Tools
  • Visual Studio 2010

1) Start with Visual Studio, VS 2010 is use to create user controls for EP, so first we have to create EP Web Application project..
  • Start VS 2010
  • Click on File> New> Project
  • Click on "Microsoft Dynamics Ax" under the "Installed Templates" tab
  • Click on "EP Web Application" and click on OK button


2) Now you can see "EPWebDevelopment1" Project in solution explorer

 

3) Now we have to add new item to create user control
  • Right click on the EPWebApplication1 at solution explorer
  • click on Add > New Item..
 
  • Click on Microsoft Dynamics Ax under the "Install Templates" tab then select "EP User Control" from list of template at right panel and click on "Add" Button
  • Now you have "WebControl1.ascx" file with two other sub-files in your project at solution explorer


4) Now Double click on WebControl1.ascx file and then click on Design from three option, you can find at bottom of central panel




















"At Design level you can add different types of AX control from the toolbox toolbar under the Dynamics Ax tab like MultiSection, Section, MultiColumn, Column, DataSource, Grid, Group etc..."

5) Click on toolbox toolbar, under the Dynamics Ax tab click on AXDataSource control

 
"AXDataSource Control needs DataSet to load the data from Dynamics Ax for User Control, make a new dataset as per your requirement and use that dataset here"

"Here I am using CustomerList dataset"

6) Now select AXMultiSection control from toolbox, in that AXMultiSection put AXSection control from the toolbox then it is look like below image



7) Now select AXGridView control from the toolbox and select the "AxDataSource1" data source for the grid from the context menu of control like below image


 

8) Now we have to select the field from the table which we want to show on that grid
  • click on the "Edit Columns.."  from the context menu of grid control to open "Bound Field Designer"

  • Add required field from Available fields box to selected fields box, for every selected field if you need to set the properties, you can set from right portion property box
  • click on OK button and all selected fields appears on the grid
9) Click on "SAVE" button and the right click on "EPWebApplication1" Project and click on Add EPWebApplication1 to AOT button

Congratulate your EP User Control is ready to Deploy on EP friends..  

  • 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 WebControl1 node. This is the managed content node for the User Control that you just created

  • Right-click the WebControl1 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 WebControl1 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 WebControl1 that points to the new page. Click Close to close the Infolog


Comments