As the RelatedDataField is using different controls to display related items in backend and widgets in the frontend, you can configure the related data field to use a custom widget for both. In order to change the frontend widget with a custom one, do one of the following:
Register the custom widget via full type name
If you choose this approach, the custom widget you create must inherit from SimpleView and IRelatedDataView. You also must override the LayoutTemplatePath. You have access to the controls through GetControl method of the current container.
you bound the controls on PreRender using the extension methods exposed for related data. Calling this.DisplayRelatedData() configures the current view and you can retrieve the related items using the GetRelatedItems method.
NOTE: If the widget does not implement ContentView or DynamicContentView, or if it does not have a property ControlDefinition, the widget must be replaced from the widget template inserted on the page.
Register the custom widget via virtual path to the widget
If you choose this approach, the custom widget you create must inherit from IRelatedDataView:
EXAMPLE: For more information about the user widget code-behind, see RelatedDataUserWidget.ascx.cs in Sitefinity SDK: documentation-samples on GitHub.
EXAMPLE: For more information about the user widget code-behind, see RelatedDataUserWidget.ascx in Sitefinity SDK: documentation-samples on GitHub.
Back To Top
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.