Export (0) Print
Expand All

Common Context Scenarios

Dynamics AX 2009

To understand context in Enterprise Portal, it is helpful to look at how common scenarios are configured. These scenarios use the built-in functionality for context. They do not require you to write any code.

In this scenario, the user has chosen an action that causes a new page in Enterprise Portal to be displayed. The data displayed in the new page is determined by the context that is passed in to the page. This scenario is used for Entity Overview pages and Task pages.

Passing Context into a Web Page

The context is passed into the page through the URL. All of the Web parts on the page that have been set to the Provider role will retrieve the context from the URL. The AxDataSource User Control components that are set to be in the Consumer role will retrieve the context from the Web part and set the current row. Any other User Control components that are linked to the AxDataSource, such as an AxForm, will display the current record.

NoteNote

Information about how to view the context passed on the URL is discussed in How to: View Context in Enterprise Portal.


In this scenario, a Dynamics Toolbar Web part is used to perform actions for the item selected or displayed in a Dynamics User Control Web part on the page. It is important to note that the toolbar is located in a separate Web part on the Web page. The Toolbar Web part passes the context to the new page where the action is to be performed. This scenario is used for List pages.

Dynamics Toolbar and Dynamics User Control

Within the Dynamics User Control Web part, an AxDataSource is set to the Provider role. The AxDataSource will provide context based on the record it is currently accessing, which is typically specified by the selection the user made in the AxGridView. The Dynamics User Control Web part is also set to the Provider role. This allows it to use Web part communication to send the AxContextList to the Dynamics Toolbar Web part. When the user chooses a menu item, the Dynamics Toolbar Web part passes the context through the URL of the new page it is displaying.

This scenario is an extension of the previous scenario. Often, the AxGridView component of a User Control has key fields that have been converted into AxHyperLinkBoundField controls. When the user clicks the hyperlink field, a new page is opened and the context is passed on the URL. The AxHyperLink field in the AxGridView passes on the context from the AxDataSource that is pointing to the selected row in the grid.

Hyperlink Field in an AxGridView Control

In this scenario, the AxToolbar and the AxGridView components are used within a User Control. It is important to note in this scenario that the toolbar is not located in a separate Web part on the page. Both components are within a single Web part, so no Web part communication is required. Both the AxToolbar and the AxGridView point to the same AxDataSource component. When the user chooses an item from the AxToolbar, the context for the current row in the AxDataSource is passed with the URL of the new page to display.

User Control with Toolbar and AxGridView

In this scenario, several Dynamics User Control Web parts are on the same Web page. When the user selects an item in one of the Web parts, the context information will be passed to the other Web parts so they can display the data that corresponds to the selection.

Dynamics User Controls on the Same Web Page

In the Web part in which the user makes a selection, the AxDataSource component is set to the Provider role. This allows it to provide the context of the selected record to the other Web parts on the page. The Dynamics User Control Web part is also set to the Provider role. This allows it to use Web part communication to send the AxContextList to the other Web parts on the page. The other Web parts on the page are set to the Consumer role, so they can receive the context. The AxDataSource components within those Web parts are also set to the Consumer role so they will set their value based on the context that was passed to the Web part.

Community Additions

ADD
Show:
© 2015 Microsoft