Override the InitializeControls method to retrieve and display the items by pasting this code:
protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition)
{
var masterDefinition = definition as IContentViewMasterDefinition;
if (masterDefinition == null) return;
var manager = LocationsManager.GetManager(this.Host.ControlDefinition.ProviderName);
var query = manager.GetLocations();
if (masterDefinition.AllowUrlQueries.HasValue && masterDefinition.AllowUrlQueries.Value)
{
query = this.EvaluateUrl(query, "Date", "PublicationDate", this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix);
query = this.EvaluateUrl(query, "Author", "Owner", this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix);
query = this.EvaluateUrl(query, "Taxonomy", "", typeof(LocationItem), this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix);
}
int? totalCount = 0;
int? itemsToSkip = 0;
if (masterDefinition.AllowPaging.HasValue && masterDefinition.AllowPaging.Value)
itemsToSkip = this.GetItemsToSkipCount(masterDefinition.ItemsPerPage, this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix);
CultureInfo uiCulture = null;
if (Config.Get<ResourcesConfig>().Multilingual)
uiCulture = System.Globalization.CultureInfo.CurrentUICulture;
var filterExpression = DefinitionsHelper.GetFilterExpression(masterDefinition);
query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions(
query,
filterExpression,
masterDefinition.SortExpression,
uiCulture,
itemsToSkip,
masterDefinition.ItemsPerPage,
ref totalCount);
this.IsEmptyView = (totalCount == 0);
if (totalCount == 0)
this.LocationsListControl.Visible = false;
else
{
this.ConfigurePager(totalCount.Value, masterDefinition);
this.LocationsListControl.DataSource = query.ToList();
}
}