/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var detailDefinition = definition as IContentViewDetailDefinition; if (detailDefinition != null) { var productsView = (ProductsView)this.Host; var item = productsView.DetailItem as ProductItem; if (item == null) { if (this.IsDesignMode()) { this.Controls.Clear(); this.Controls.Add(new LiteralControl("A product item was not selected or has been deleted. Please select another one.")); } return; } else { this.DetailsView.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(DetailsView_ItemDataBound); this.DetailsView.DataSource = new ProductItem[] { item }; } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var detailDefinition = definition as IContentViewDetailDefinition; if (detailDefinition != null) { var realEstateView = (RealEstateView)this.Host; var item = realEstateView.DetailItem as RealEstateItem; if (item == null) { if (this.IsDesignMode()) { this.Controls.Clear(); this.Controls.Add(new LiteralControl("A Real Estate item was not selected or has been deleted. Please select another one.")); } return; } else { this.librariesManager.Provider.SuppressSecurityChecks = true; this.DetailsViewControl.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(DetailsView_ItemDataBound); this.DetailsViewControl.DataSource = new RealEstateItem[] { item }; string gMapsKey = WebConfigurationManager.AppSettings["GoogleMapsKey"]; this.Page.ClientScript.RegisterClientScriptInclude("gmaps", string.Format("http://maps.google.com/maps?file=api&v=2&key={0}", gMapsKey)); } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var detailDefinition = definition as IContentViewDetailDefinition; if (detailDefinition != null) { var agentsView = (AgentsView)this.Host; this.WebServiceUrlHidden.Value = this.webServiceUrl; var item = agentsView.DetailItem as AgentItem; if (item == null) { if (this.IsDesignMode()) { this.Controls.Clear(); this.Controls.Add(new LiteralControl("An agent item was not selected or has been deleted. Please select another one.")); } return; } else { this.librariesManager.Provider.SuppressSecurityChecks = true; this.DetailsViewControl.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(DetailsView_ItemDataBound); this.DetailsViewControl.DataSource = new AgentItem[] { item }; } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { // ensure a valid definition is passed var detailDefinition = definition as IContentViewDetailDefinition; if (detailDefinition == null) { return; } // retrieve item from host control var locationsView = (LocationsView)this.Host; var item = locationsView.DetailItem as LocationItem; if (item == null) { // no item if (this.IsDesignMode()) { this.Controls.Clear(); this.Controls.Add(new LiteralControl("A location item was not selected or has been deleted. Please select another one.")); } return; } // show item details this.DetailsViewControl.DataSource = new LocationItem[] { item }; }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var masterDefinition = definition as IContentViewMasterDefinition; if (masterDefinition != null) { var query = this.Manager.GetProducts(); 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", string.Empty, typeof(ProductItem), 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 (AppSettings.CurrentSettings.Multilingual) { uiCulture = System.Globalization.CultureInfo.CurrentUICulture; } //the filter is adapted to the implementation of ILifecycleDataItemGeneric, so the culture is taken in advance when filtering published items. this.FilterExpression = ContentHelper.AdaptMultilingualFilterExpression(this.FilterExpression); var filterExpression = DefinitionsHelper.GetFilterExpression(this.FilterExpression, this.AdditionalFilter); query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions( query, filterExpression, masterDefinition.SortExpression, uiCulture, itemsToSkip, masterDefinition.ItemsPerPage, ref totalCount); this.IsEmptyView = (totalCount == 0); if (totalCount == 0) { this.NewsList.Visible = false; } else { this.ConfigurePager(totalCount.Value, masterDefinition); this.NewsList.DataSource = query.ToList(); this.NewsList.PreRender += new EventHandler(NewsList_PreRender); } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var masterDefinition = definition as IContentViewMasterDefinition; if (masterDefinition != null) { var query = this.Manager.GetAgents(); 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(AgentItem), 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.AgentsListControl.Visible = false; } else { this.ConfigurePager(totalCount.Value, masterDefinition); this.librariesManager.Provider.SuppressSecurityChecks = true; this.AgentsListControl.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(AgentsListControl_ItemDataBound); this.AgentsListControl.DataSource = query.ToList(); } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { if (this.CurrentPage != null) { this.Title.Text = this.CurrentPage.Title; } lbnListView.Click += new EventHandler(ViewTypeButtonsClicked); lbnThumbnailView.Click += new EventHandler(ViewTypeButtonsClicked); lbnItemPerPage_Nine.Click += new EventHandler(ItemPerPageButtonsClicked); lbnItemPerPage_Eighteen.Click += new EventHandler(ItemPerPageButtonsClicked); lbnItemPerPage_Twentyseven.Click += new EventHandler(ItemPerPageButtonsClicked); lbnSortBy_Price.Click += new EventHandler(SortByButtonsClicked); if (!Page.IsPostBack) { this.BindItems(); } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { // ensure a valid definition is passed var detailDefinition = definition as IContentViewDetailDefinition; if (detailDefinition == null) return; // retrieve item from host control var ProjectsView = (ProjectsView)this.Host; var item = ProjectsView.DetailItem as ProjectItem; if (item == null) { // no item if (this.IsDesignMode()) { this.Controls.Clear(); this.Controls.Add(new LiteralControl("A Project item was not selected or has been deleted. Please select another one.")); } return; } // show item details this.DetailsViewControl.DataSource = new ProjectItem[] { item }; }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var detailDefinition = definition as IContentViewDetailDefinition; if (detailDefinition != null) { var productsView = (ProductsView)this.Host; var item = productsView.DetailItem as ProductItem; if (item == null) { if (this.IsDesignMode()) { this.Controls.Clear(); this.Controls.Add(new LiteralControl("A product item was not selected or has been deleted. Please select another one.")); } return; } else { this.DetailsView.ItemDataBound += new EventHandler<RadListViewItemEventArgs>(DetailsView_ItemDataBound); this.DetailsView.DataSource = new ProductItem[] { item }; } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { // ensure a valid definition is passed var masterDefinition = definition as IContentViewMasterDefinition; if (masterDefinition == null) { return; } // retrieve locations from the manager var manager = LocationsManager.GetManager(this.Host.ControlDefinition.ProviderName); var query = manager.GetLocations(); // check for filters on the locations query 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); } // modify pager based on query results int?totalCount = 0; int?itemsToSkip = 0; if (masterDefinition.AllowPaging.HasValue && masterDefinition.AllowPaging.Value) { itemsToSkip = this.GetItemsToSkipCount(masterDefinition.ItemsPerPage, this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); } // culture for Urls in pager CultureInfo uiCulture = null; if (Config.Get <ResourcesConfig>().Multilingual) { uiCulture = System.Globalization.CultureInfo.CurrentUICulture; } // check for additional filters set by the definition var filterExpression = String.Empty; // modify the query with everything from above query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions( query, filterExpression, masterDefinition.SortExpression, uiCulture, itemsToSkip, masterDefinition.ItemsPerPage, ref totalCount); this.IsEmptyView = (totalCount == 0); // display results if (totalCount == 0) { this.LocationsListControl.Visible = false; } else { this.ConfigurePager(totalCount.Value, masterDefinition); this.LocationsListControl.DataSource = query.ToList(); } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { if (this.CurrentPage != null) { this.Title.Text = this.CurrentPage.Title; } lbnListView.Click += new EventHandler(ViewTypeButtonsClicked); lbnThumbnailView.Click += new EventHandler(ViewTypeButtonsClicked); lbnItemPerPage_Nine.Click += new EventHandler(ItemPerPageButtonsClicked); lbnItemPerPage_Eighteen.Click += new EventHandler(ItemPerPageButtonsClicked); lbnItemPerPage_Twentyseven.Click += new EventHandler(ItemPerPageButtonsClicked); lbnSortBy_Price.Click += new EventHandler(SortByButtonsClicked); //lbnSortBy_Location.Click += new EventHandler(SortByButtonsClicked); if (!Page.IsPostBack) { this.BindItems(); } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { var masterDefinition = definition as IContentViewMasterDefinition; if (masterDefinition != null) { var query = this.Manager.GetProducts(); 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", string.Empty, typeof(ProductItem), 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 (AppSettings.CurrentSettings.Multilingual) { uiCulture = System.Globalization.CultureInfo.CurrentUICulture; } //the filter is adapted to the implementation of ILifecycleDataItemGeneric, so the culture is taken in advance when filtering published items. this.FilterExpression = ContentHelper.AdaptMultilingualFilterExpression(this.FilterExpression); var filterExpression = DefinitionsHelper.GetFilterExpression(this.FilterExpression, this.AdditionalFilter); query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions( query, filterExpression, masterDefinition.SortExpression, uiCulture, itemsToSkip, masterDefinition.ItemsPerPage, ref totalCount); this.IsEmptyView = (totalCount == 0); if (totalCount == 0) { this.NewsList.Visible = false; } else { this.ConfigurePager(totalCount.Value, masterDefinition); this.NewsList.DataSource = query.ToList(); this.NewsList.PreRender += new EventHandler(NewsList_PreRender); } } }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { // ensure a valid definition is passed var masterDefinition = definition as IContentViewMasterDefinition; if (masterDefinition == null) return; // retrieve Projects from the manager var manager = ProjectsManager.GetManager(this.Host.ControlDefinition.ProviderName); var query = manager.GetProjects(); // check for filters on the Projects query 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(ProjectItem), this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); } // modify pager based on query results int? totalCount = 0; int? itemsToSkip = 0; if (masterDefinition.AllowPaging.HasValue && masterDefinition.AllowPaging.Value) itemsToSkip = this.GetItemsToSkipCount(masterDefinition.ItemsPerPage, this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); // culture for Urls in pager CultureInfo uiCulture = null; if (Config.Get<ResourcesConfig>().Multilingual) uiCulture = System.Globalization.CultureInfo.CurrentUICulture; // check for additional filters set by the definition var filterExpression = String.Empty; // modify the query with everything from above query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions( query, filterExpression, masterDefinition.SortExpression, uiCulture, itemsToSkip, masterDefinition.ItemsPerPage, ref totalCount); this.IsEmptyView = (totalCount == 0); // display results if (totalCount == 0) this.ProjectsListControl.Visible = false; else { this.ConfigurePager(totalCount.Value, masterDefinition); this.ProjectsListControl.DataSource = query.ToList(); } }