共用方式為


How to: Add Code to User Controls

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

You can add code to User Controls to enhance their functionality. Adding code to a User Control is like adding code to an ASP.NET control. For more information about how to write code for User Controls, see Coding User Controls.

Adding Code to a User Control

To add code to a User Control

  1. Start Visual Studio. If User Account Control (UAC) is active, be sure you start Visual Studio with administrative privileges.

  2. Open the EP Web Application project that contains the User Control to which you want to add code. For information about how to create a project, see How to: Create an EP Web Application Project.

  3. In Solution Explorer, right-click the User Control and then click View Code.

  4. Make the necessary code additions and modifications.

  5. Optionally, you can build the EP Web Application project to verify that there are no compiler errors in your code.

  6. Save the changes for the User Control.