How to use RadListView datagrouping in Widget Templates?

Posted by Community Admin on 05-Aug-2018 12:11

How to use RadListView datagrouping in Widget Templates?

All Replies

Posted by Community Admin on 10-Mar-2015 00:00

Hi,

I have made a dynamic module which is used to import from a Sharepoint document library.

Then I tried to change the generated widgets in Design->Widget Templates to implement datagrouping in the RadListView. I wanted to group by a field named 'DocumentationCategory'

The problem is that Sitefinity then tells me that the GroupField does not exist in the DynamicContent:

No property or field 'DocumentationCategory' exists in type 'DynamicContent'

Here is my code:

<telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="DataGroupPlaceHolder3" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false"
   DataKeyNames="Title">
  <DataGroups>
      <telerik:ListViewDataGroup GroupField="DocumentationCategory" DataGroupPlaceholderID="DataGroupPlaceHolder2"
          SortOrder="Ascending">
          <DataGroupTemplate>
              <div class="sfContentBlock">
                <table>
                  <tbody>
                  <tr>
                  <th>Document</th>
                    <th>Title</th>
                  </tr>
                  <asp:PlaceHolder ID="ItemsContainer" runat="server" />
                  </tbody>
                </table>
                </div>   
          </DataGroupTemplate>
      </telerik:ListViewDataGroup>
  </DataGroups>
  <LayoutTemplate>
      <asp:PlaceHolder ID="DataGroupPlaceHolder2" runat="server"></asp:PlaceHolder>
  </LayoutTemplate>
  <ItemTemplate>
      <tr>
        <td>
          <sf:SitefinityLabel runat="server" Text='<%# Eval("Shorttitle")%>' WrapperTagName="div" HideIfNoText="true" CssClass="sfitemShortTxt" data-sf-field="Shorttitle" data-sf-ftype="ShortText"/>
        </td>
        <td>
            <sf:AssetsField runat="server" DataFieldName="FileLeafRef" />
        </td>
      </tr>
   </ItemTemplate
</telerik:RadListView>
 

What is wrong?

Thanks in advance.

Posted by Community Admin on 13-Mar-2015 00:00

Hello Ludwig,

The problem is that the lit view tries to find that field in the DynamicContent type. However, this field is 'dynamic' and is not part of the DynamicContent class, which throws the exception. You can either group the datasource and rebind after that, or bind the listview of a model class that 'translates' the dynamic content default and custom properties to that model class. The model class will have default field DocumentationCategory.

Regards,
Nikola Zagorchev
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
 

This thread is closed