Provides access to the LinkUnlinkController‘s Link Action.
A PopupWindowShowAction object representing the Link Action.
The Link Action is intended to add required existing objects to a collection property displayed by a nested List View:
In a Windows Forms application:
In an ASP.NET application:
To show all existing objects of the current collection property’s object type, a List View is created and shown in a pop-up Window. This List View is generated using information from the Application Model. The node which is used as the information source is determined by the LinkView property of the Views | <DetailView> | Items | <PropertyEditor> node defining the current collection property:
By default, the LinkView property is set to the value of the DefaultLookupListView property of the BOModel | <Class> node, defining the collection property’s object type. If the LinkView property is not specified, the ListView node used to display the collection property will be used.
To create a custom List View, handle the LinkUnlinkController.CustomCreateLinkView event.
You can filter the created List View by setting a criteria for the objects to be displayed. For this purpose, use the DataSourceCriteriaAttribute for the collection property. In addition, you can provide a custom collection source for the created List View. For this purpose, use the DataSourcePropertyAttribute. For details, refer to the How to: Filter a Link Dialog’s List View topic.
The created List View is shown in a pop-up Window. In a Windows Forms application, the LookupForm Template is used for this Window. In an ASP.NET Web application, the Dialog.aspx page is used as a Template. To customize the pop-up Window’s Template, handle the PopupWindowShowAction.CustomizePopupWindowParams event that occurs after assigning the Template to the Window. Use the handler’s CustomizeTemplateEventArgs.Template parameter to access the Template. The LinkUnlinkController handles this event to add the Search functionality to the Template, if required. By default, this functionality is activated when a created List View’s collection source contains more than 25 objects. This count represents the minimum number of objects required to activate the Search functionality. It is specified by the IModelOptions.LookupSmallCollectionItemCount property of the Application Model‘s Options node.
There are other modes for showing the List View and the Search functionality in the Link Action’s pop-up Window. To select the required mode, use the LookupEditorModeAttribute for the collection property. Alternatively, you can use the Model Editor. The value of the LookupEditorMode attribute’s mode parameter is set for the IModelCommonMemberViewItem.LookupEditorMode property of the BOModel | <Class> | OwnMembers | <Member> node, corresponding to the current collection property. For details, refer to the How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows topic.
If you do not want to support the Search functionality, or need to modify it for a particular Link Action’s pop-up Widnow, inherit from the LinkUnlinkController and override the CustomizeLinkTemplate method.
The LookupEditorMode, DataSourceCriteria and DataSourceProperty features are supported when the Link Action’s List View is created using information from a LookupListView node. This node is specified by the LinkView property of the DetailView | Items | PropertyEditor node, corresponding to the current collection property.
To add an Action to the Link Action’s pop-up Window, first determine what Action Containers can be included in the Window’s Template. For information on this, refer to the Add Actions to a Popup Window topic.
You can provide a custom list of the objects to be linked by the Link Action. For this purpose, handle the LinkUnlinkController.QueryLinkObjects event.
When implementing a custom Controller to modify the behavior of the LinkUnlinkController or its Link Action, you may have to determine whether the current List View is the one of the Link Action’s pop-up Windows. For this purpose, use one of the following criteria:
Use the List View’s ID:
Use the Template context of the List View’s Window:
By default, the Link Action is active under the following conditions:
- If the current List View’s collection source is of the PropertyCollectionSource type, which is satisfied for List Views displaying collection properties.
- The current List View is not read-only.
- The applied Security System does not prohibit the current View’s access.
- The collection property represents the Many-to-Many relationship’s part; or it represents the One-to-Many relationship’s Many part, being non-aggregated.
To ascertain why the Link Action is currently deactivated or disabled, use the DiagnosticInfo Action. If you need to change the Action’s “active” or “enabled” state in code, use its ActionBase.Active or ActionBase.Enabled property, respectively.