You are here: Catalog System > Catalog Data Sources

Catalog Data Sources

Key classes and files

Catalog data sources

How it works

Below is an example of creating a CatalogIndexSearchDataSource.

private CatalogIndexSearchDataSource CreateCatalogIndexSearchDataSource()
// Set up CatalogEntrySearchCriteria object.
SearchFilterHelper sfHelper = SearchFilterHelper.Current;
string keywords = Request.QueryString["search"];
SearchSort sortObject = CatalogEntrySearchCriteria.DefaultSortOrder
CatalogEntrySearchCriteria criteria = sfHelper.CreateSearchCriteria(keywords, sortObject);
// Set up CatalogIndexSearchDataSource object.
int startIndex = SomeListView.StartRowIndex;
int recordsToRetrieve = pageSize;
int count = 0;
CatalogEntryResponseGroup responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo);
bool cacheResults = true;
TimeSpan cacheTimeout = new TimeSpan(0, 0, 30);
CatalogIndexSearchDataSource dataSource = null;
// No need to perform search if there are no catalogs specified.
if (criteria.CatalogNames.Count != 0)
Entries entries = sfHelper.SearchEntries(criteria, startIndex, recordsToRetrieve, out count, responseGroup, cacheResults, cacheTimeout);
dataSource = new CatalogIndexSearchDataSource();
dataSource.TotalResults = count;
dataSource.CatalogEntries = entries;
return dataSource;

Once the CatalogIndexSearchDataSource object is created you can bind it an ASP.NET server control that supports data binding, such as the ListView control. Once bound you have accesss to a collection of catalog entry results.

SomeListView.DataSource = CatalogIndexSearchDataSource
CatalogIndexSearchDataSource.CatalogEntries // propety of type Entries
CatalogIndexSearchDataSource.CatalogEntries.Entry // array of type Entry[]





Last updated: 2011-05-17 | Copyright © EPiServer AB | Send feedback to us