What best practice using Related Data in Sitefinity 7 - General Discussions - General Discussions - Progress Community
 General Discussions

What best practice using Related Data in Sitefinity 7

  • What best practice using Related Data in Sitefinity 7
  • Hi experts,

    What should use if using related data (especially for dynamic content related data) , on Sitefinity 7 as i know 2 things:

    1. adding a custom field on content type with field type related data, or...
    2. adding parent child (ex. content A has child content B it makes automatic related data)

    so, what best practice for this case ? Thank you. I appreciated for an answer.

    Regards,

  • Hello Anthony,

    There is no best approach here. Both methods are viable and you should choose based on your preferences. I can personally recommend you use the first approach as there you can have multiple related data items, while multiple child modules with a single parent one is not possible in our system for the time being.

    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  •  May I have a sample code for the widget template for the second point (I did not find documented on the sitefinity documentation for the widget template of the second point about related content between dynamic content parent and dynamic content child (not related data field) )
  • anyway, i found the solutions point 2nd for widget template parent-child related data : 

    using this syntax to datasource repeater/ list

    <%# Telerik.Sitefinity.DynamicModules.DynamicModuleManager.GetManager().GetChildItems((Telerik.Sitefinity.DynamicModules.Model.DynamicContent)Container.DataItem) %>

    .... register block & assembly block....

    ....
    <telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
        <LayoutTemplate>
            <ul>
                <asp:PlaceHolder ID="ItemsContainer" runat="server" />
            </ul>
        </LayoutTemplate>
        <ItemTemplate>
            <li class="sfitem sflistitem sfClearfix" data-sf-provider='<%# Eval("Provider.Name")%>' data-sf-id='<%# Eval("Id")%>' data-sf-type="Telerik.Sitefinity.DynamicModules.Model.DynamicContent">
                <img src='<%# ((Telerik.Sitefinity.Libraries.Model.Image)Eval("Image")).Url %>' />
                <ul>
                    <asp:Repeater ID="Repeater1" runat="server" DataSource='<%# Telerik.Sitefinity.DynamicModules.DynamicModuleManager.GetManager().GetChildItems((Telerik.Sitefinity.DynamicModules.Model.DynamicContent)Container.DataItem) %>'>
                        <ItemTemplate>
                            <li>
                                <%# Eval("Title") %>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </li>
        </ItemTemplate>
    </telerik:RadListView>
    ....

     ...