How to use RadListView datagrouping in Widget Templates?
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.
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