I need to display a block on a page. For the very first time when page load, only 6 blocks should be displayed by default. And there is a "Load More" button on that page, once user click on this button the next 6 more blocks should be displayed and so on.
Option 1 is to take control of the rendering of content area yourself. You can use the ContentArea.Items collection for this:
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
if (page != null && page.ContentArea != null && page.ContentArea.FilteredItems.Any())
foreach (var contentItem in page.ContentArea.FilteredItems)
var item = contentLoader.Get<INSERT CONTENT TYPE>(contentItem.ContentLink);
//print your properties...
But I getting this error:
The name 'Locate' does not exist in the current contex
Is there any namespace required for Locate? What Is that?
Locate is a shortcut property that is available on some classes that is used to fetch instances of services. You can also use the ServiceLocator for that directly as well (like above) and that is in the