Custom Rendering of Generic Content List
Hello,
I have a requirement where I need to display a set of content blocks in paged manner. To implement this I was expecting List module which was available in version 3.7 but I could not find it in 4.0 beta. I need a way to create a list of content blocks in CMS and access that list from asp.net code and render them in paged manner. Thanks in advance for your support.
Hi Kiran,
You can create Generic Content items and then display them on a page by Generic content list widget.
Best wishes,
Ivan Dimitrov
the Telerik team
Thanks for the immediate reply Ivan.
I have added a generic content list widget but it is displaying all the generic content blocks which were published. I want only a particular set of content blocks (Say, all belong to some category) to be displayed on the page. But I have found no way to filter the content items based on categories or tags. Does this generic content list widget allow me to customize the pagination? Or should I get the content items from c# code in a user control and add my own logic to render them in some fashion (in this case paging)?
If you can provide me a sample code which returns me a list of content items those belong to a particular category and also how to extract the HTML content from those content items, that would be great help to me. I can take it there on and fulfill my requirements.
Thanks,
Kiran
Hi Kiran,
Please take a look at this post that shows how to filter the control by taxon id. This post shows how to do this porgrammatically.
The pages is set through MasterGridViewElement. You can change the page size from
Home > ControlDefinition > Views > GenericContentMasterView when you open the control for editing.
If you want to modify the logic of the pager you have to create a custom definition and replace the default MastersView with your custom one
var masterView =
new
MasterGridViewElement(frontendView.ViewsConfig)
Title =
"MasterView"
,
ViewName = FrontendMasterViewName,
ViewType =
typeof
(Telerik.Samples.Sitefinity.MasterViewCustom),
DisplayMode = FieldDisplayMode.Read,
ResourceClassId = resourceClassId,
FilterExpression = DefinitionsHelper.PublishedOrScheduledFilterExpression,
AllowPaging =
true
,
ItemsPerPage = 20
;
MasterViewCustom
should inherit from MasterView
where you can override the virtual ConfigurePager method or implement a custom pager.